Firefox throws exceptions when using selection functions on HTMLInputElements that do not support selection. Maybe WebKit should to? Patch on its way.
Created attachment 26680 [details] Patch
Are there any known sites that require this?
(In reply to comment #2) > Are there any known sites that require this? Not that I know of, no. As far as I can tell, we have tried to be compatible with Firefox here. The selection-function test seemed to pass on Firefox but only because it throws exceptions along the way. I like the fact that this gets rid of the custom getOwnPropertySlot implementation. Come to think of it, that custom implementation will get in the way of changes to setSelectionRange on buttons: HTMLInputElement.prototype.setSelectionRange = function(){}; var b = document.getElementById("button"); b.setSelectionRange; // <--- undefined Also, returning undefined will probably lead to exceptions throw in the code anyway since people will most likely try to call the function or use the value of the attributes?
What does IE do? I am always hesitant to throw exceptions as they can often break un-expecting scripts.
IE does not support the selection attributes and functions on HTMLInputElements. Therefore, I think that Firefox compatibility should be the goal for these functions.
This takes care of the getter for selectionStart, for selectionEnd, and the function setSelectionRange. What about the setters for selectionStart and selectionEnd? Is it appropriate for them to silently do nothing, or should they be throwing exceptions too?
Good point, thanks! The setters should be throwing exceptions as well. I'll upload an updated patch ASAP.
Created attachment 26768 [details] Updated to throw exceptions in selectionStart and selectionEnd setters
Darin and Sam, could one of you guys have a look at this again? Thanks.
Comment on attachment 26768 [details] Updated to throw exceptions in selectionStart and selectionEnd setters r=me
Committed in http://trac.webkit.org/changeset/40293