You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var div = Builder.node("div", {style: {top: 10px, left: 20px}});
Builder._attributes just copies the dict to the style member of the
HTMLElement, but this doesn't work quite right because browsers don't really know how to type convert a dict to a CSSStyleDeclaration object. So you are forced to use a really long text string.
It would be better if _attributes copies the attributes recursively. Something like this:
for (var attr in attributes) {
attr = JSON.parse(attr);
if (attr) {
for (k in attr) {
element[attr][k] = attr[k];
}
}
}
The actual code will of course need to prevent cyclic references and set a depth of the copying if needed. This should take care of the general case where one wants to set the properties of any nested objects on any DOM elements.
The text was updated successfully, but these errors were encountered:
Problem:
Builder._attributes just copies the dict to the style member of the
It would be better if _attributes copies the attributes recursively. Something like this:
The actual code will of course need to prevent cyclic references and set a depth of the copying if needed. This should take care of the general case where one wants to set the properties of any nested objects on any DOM elements.
The text was updated successfully, but these errors were encountered: