Bug 141199 - Range startContainer can't access parent 3 levels up in a contentEditable
Summary: Range startContainer can't access parent 3 levels up in a contentEditable
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-03 09:45 PST by Brandon Andrews
Modified: 2015-02-03 14:39 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brandon Andrews 2015-02-03 09:45:59 PST
So startContainer in the range object behaves rather funny. It's like a pseudo element. === randomly fails when comparing to the DOM element got by getElementById, but .isEqualNode will always work. This might be correct to the spec I'm not sure, but one oddity in Webkit is that you can only access 2 parents up. If you do something like:

range.startContainer.parentNode.parentNode.parentNode it returns null. If you get the element startContainer is referencing and do element.parentNode.parentNode.parentNode it returns the correct DOM element. Very odd behavior.
Comment 1 Alexey Proskuryakov 2015-02-03 12:40:54 PST
Could you please attach a complete test case?
Comment 2 Brandon Andrews 2015-02-03 14:39:02 PST
I actually started trying to make a test case after submitting the bug assuming it would be easy to reproduce in a jsfiddle. I can't seem to reproduce it in a small test case even with most of the code.

It's not really a big issue. I'm sure someone else will be able to replicate it sometime in a smaller project. This project is so large it's hard to rip out everything to see what could be causing such odd behavior.

Sorry about that.