Skip to content
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

Closed
DartBot opened this issue May 2, 2013 · 15 comments
Closed

Node.parent does not always work with IE #10387

DartBot opened this issue May 2, 2013 · 15 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. browser-ie closed-obsolete Closed as the reported issue is no longer relevant library-html P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@DartBot
Copy link

DartBot commented May 2, 2013

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

@madsager
Copy link
Contributor

madsager commented May 2, 2013

Added Area-HTML, Triaged labels.

@blois
Copy link
Contributor

blois commented May 2, 2013

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.

@DartBot
Copy link
Author

DartBot commented May 3, 2013

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...

@blois
Copy link
Contributor

blois commented May 3, 2013

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:
https://connect.microsoft.com/IE/feedback/details/780874/node-contains-is-incorrect

And I just opened a new one for Node.parentElement (though it's very much related to Node.contains)-
https://connect.microsoft.com/IE/feedback/details/786279/node-parentelement-incorrectly-returns-null


Added Triaged label.

@DartBot
Copy link
Author

DartBot commented May 6, 2013

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.

@blois
Copy link
Contributor

blois commented May 29, 2013

Added this to the M6 milestone.

@efortuna
Copy link
Contributor

Removed this from the M6 milestone.
Added this to the Later milestone.

@DartBot
Copy link
Author

DartBot commented Aug 29, 2013

This comment was originally written by da...@altern.org


See also, the same bug in jQuery:
http://bugs.jquery.com/ticket/13265
Maybe the way they fixed it can help with Dart ?

@DartBot
Copy link
Author

DartBot commented Aug 29, 2013

This comment was originally written by da...@altern.org


The parent function in jQuery was changed from:
    return elem.parentElement;
to:
    var parent = elem.parentNode;
    return parent && parent.nodeType !== 11 ? parent : null;

(it returns parentNode unless the parent is a document fragment)

@efortuna
Copy link
Contributor

efortuna commented Oct 3, 2013

Added html-api label.

@blois
Copy link
Contributor

blois commented Oct 3, 2013

Removed html-api label.

@kevmoo
Copy link
Member

kevmoo commented Apr 7, 2014

Removed Area-HTML label.
Added Area-Library, Library-Html labels.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the Later milestone.
Added Oldschool-Milestone-Later label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-Later label.

@alan-knight
Copy link
Contributor

Added Browser-IE label.

@DartBot DartBot added Type-Defect area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-html browser-ie labels Jan 13, 2015
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed triaged labels Feb 29, 2016
@matanlurey matanlurey added the closed-obsolete Closed as the reported issue is no longer relevant label Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. browser-ie closed-obsolete Closed as the reported issue is no longer relevant library-html P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

8 participants