Open Bug 718741 Opened 14 years ago Updated 3 years ago

document.getSelection() should return null if defaultView is null

Categories

(Core :: DOM: Core & HTML, defect, P5)

x86
Linux
defect

Tracking

()

People

(Reporter: ayg, Unassigned)

Details

document.implementation.createHTMLDocument("").getSelection() behaves as follows in different browsers: * IE9: Returns a Selection object distinct from window.getSelection() * Firefox 12.0a1 (2012-01-12) and Opera Next 12.00 alpha: Returns the same as window.getSelection() * Chrome 17 dev: Returns null Such a document has no useful selection, so I've specced WebKit's behavior: """ The getSelection() method on the Document interface must return null if the context object's defaultView is null, and the context object's selection otherwise. """ http://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#dom-document-getselection This is admittedly a bad definition; see discussion starting at <http://lists.w3.org/Archives/Public/public-webapps/2012JanMar/0159.html>, and "View comments" in the spec. However, we can at least try to converge in simple cases like document.implementation.createHTMLDocument(""). I wrote tests for that case, which WebKit passes and everyone else fails (look for "HTML document with null defaultView"): http://dvcs.w3.org/hg/editing/raw-file/tip/selecttest/getSelection.html If anyone has suggestions of other cases to test, suggest them and I can write more tests.
Component: Selection → DOM
QA Contact: selection → general
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: minor → S4
You need to log in before you can comment on or make changes to this bug.