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
Given node an instance of that Node class (let's call it pm.Node for clarity), calling node.isText works fine, however calling node.text throws the following exception:
EXCEPTION: Unhandled exception:
Not a valid Node
#0 BlinkNode.textContent_Getter_ (dart:_blink:11270)
#1 Node.text (dart:html:28048)
Apparently, the VM gets sufficiently confused about types that it tries to call the text method from dart:html's Node class (!?!), and then complains it's not an instance of that class. I can also confirm that this error occurs when trying to call any dart:htmlNode method on my pm.Node instance, regardless of whether it exists on pm.Node or not. In contrast, trying to call a method or getter that doesn't exists on either throws the expected NoSuchMethodError: Class 'Node' has no instance getter '___'..
Fortunately, after a few hours of head scratching I figured out that I can rename the getter to JS$text to work around this issue, but it's still a very confusing and annoying bug.
This may be related to #25785, which was fixed recently.
The text was updated successfully, but these errors were encountered:
We're also getting a lot of noisy errors from Dartium on the console, which never seemed to cause a problem, but might be related to this:
Return value for method: text is Node which is inconsistent with all typed JS interop definitions for method text.
Return value for method: node is Node which is inconsistent with all typed JS interop definitions for method node.
(lack of context of which Node is meant here may hide the fact that the wrong one is found/expected, as per the bug above)
There stacktrace references the VM so no luck tracing it sadly.
I've encountered a confusing issue in Dartium when trying to interoperate with a JS library ProseMirror that exposes instances of a class named
Node
.I've defined an interop definition around it like so:
Given
node
an instance of thatNode
class (let's call itpm.Node
for clarity), callingnode.isText
works fine, however callingnode.text
throws the following exception:Apparently, the VM gets sufficiently confused about types that it tries to call the
text
method fromdart:html
'sNode
class (!?!), and then complains it's not an instance of that class. I can also confirm that this error occurs when trying to call anydart:html
Node
method on mypm.Node
instance, regardless of whether it exists onpm.Node
or not. In contrast, trying to call a method or getter that doesn't exists on either throws the expectedNoSuchMethodError: Class 'Node' has no instance getter '___'.
.Fortunately, after a few hours of head scratching I figured out that I can rename the getter to
JS$text
to work around this issue, but it's still a very confusing and annoying bug.This may be related to #25785, which was fixed recently.
The text was updated successfully, but these errors were encountered: