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
Affected version: At least 1.11.3, but most likely 1.11.1 and above
Consider the following example:
/* 1 */TextNodex = newTextNode("zzz");
/* 2 */x.attributes(); // this calls LeafNode.ensureAttributes() and creates attributes map/* 3 */TextNodey = (TextNode) x.clone();
/* 4 */y.text("xxx"); // now x.text() is also "xxx"
Here, on step 1 we create a new TextNode with a value of zzz.
On step 2ensureAttributes() is called indirectly, which replaces Stringvalue with Attributes containing #text = zzz entry.
On step 3 we clone the node.
If we inspect properties after step 3 we'll notice that x.attributes() and y.attributes() are returning the same instance
On step 4 we update content of y, which is "magically" mirrored to x as well.
In 1.10.3 attributes were explicitly cloned in Node.doClone() method, but starting with 1.11.1attributes were moved to TextNode and then to LeafNode without any clone implementation.
The text was updated successfully, but these errors were encountered:
Affected version: At least
1.11.3
, but most likely1.11.1
and aboveConsider the following example:
1
we create a newTextNode
with avalue
ofzzz
.2
ensureAttributes()
is called indirectly, which replacesString
value
withAttributes
containing#text = zzz
entry.3
we clone the node.3
we'll notice thatx.attributes()
andy.attributes()
are returning the same instance4
we update content ofy
, which is "magically" mirrored tox
as well.In
1.10.3
attributes were explicitly cloned inNode.doClone()
method, but starting with1.11.1
attributes
were moved toTextNode
and then toLeafNode
without any clone implementation.The text was updated successfully, but these errors were encountered: