Bug 141199
| Summary: | Range startContainer can't access parent 3 levels up in a contentEditable | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Brandon Andrews <sirisian> |
| Component: | HTML Editing | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED INVALID | ||
| Severity: | Normal | CC: | ap |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Brandon Andrews
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.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
Could you please attach a complete test case?
Brandon Andrews
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.