New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node.parent does not always work with IE #10387
Comments
In Dart, parent refers to the parent element, use parentNode to access the node parent. I've opened a couple of IE bugs in this area in the past, hoping they fix these in IE11! Added AsDesigned label. |
This comment was originally written by da...@altern.org A parent is always an element or a document. If "parent" refers to the parent element, it should also work for a text node. Do you really mean that "parent" cannot be used on text nodes ?!? If so, it should be well documented, because this is not intuitive... Or do you mean that you are waiting for the bug to be fixed in IE, which would mean that it is not a goal for Dart to work with IE 9 ? I am confused... |
Fair point. "parent" should work everywhere, it's a bug in IE that it does not. There's a balance between what gets polyfilled and how we expose more subtle browser differences. For this, and Node.contains (which has a similar issue), I think we should document the behavior instead. If you're interested, my IE bug on Node.contains is: And I just opened a new one for Node.parentElement (though it's very much related to Node.contains)- Added Triaged label. |
This comment was originally written by da...@altern.org Documentation would be good. Maybe another solution would be to have "parent" in Element (and possibly other classes) but not in Node. It would not be too bad if parentNode exists and works in Node. |
Added this to the M6 milestone. |
This comment was originally written by da...@altern.org See also, the same bug in jQuery: |
This comment was originally written by da...@altern.org The parent function in jQuery was changed from: (it returns parentNode unless the parent is a document fragment) |
Added html-api label. |
Removed html-api label. |
Removed Area-HTML label. |
Removed this from the Later milestone. |
Removed Oldschool-Milestone-Later label. |
Added Browser-IE label. |
This issue was originally filed by da...@altern.org
What steps will reproduce the problem?
Try this code:
SpanElement span = new SpanElement();
span.appendText('test');
Text n = span.nodes.first;
n.parent.appendText('new');
What is the expected output? What do you see instead?
I expect to get a span with the text 'testnew'. With IE9 and IE10 I get an error.
What version of the product are you using? On what operating system?
Dart SDK 0.5.3.0_r22223, Windows 7 and Windows 8.
Please provide any additional information below.
dart2js is using the parentElement property to get the parent node. However, this does not work with text nodes in Internet Explorer:
https://developer.mozilla.org/en-US/docs/DOM/Node.parentElement#Browser_compatibility
The text was updated successfully, but these errors were encountered: