Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Return null for outer/inner width/height calls on window/document. Fi…
…xes #7557.
- Loading branch information
timmywil
committed
May 25, 2011
1 parent
1d1cb58
commit edb2286
Showing
3 changed files
with
37 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
edb2286
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can detect window and document as easily as
elem.style
, why not just return.height()
/.width()
when called on window or document? If there's no performance penalty for handling them, I think the few extra bytes would be worth it.edb2286
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose we could, but that might be misleading since the outer/inner functions don't make sense on the window/document. I'm not sure we want to encourage their usage since in the past they have either returned NaN(1.0-1.3.2) or thrown an exception(1.4+). We now return null as snover once suggested so that at least the return values are consistent.
Also, see next commit. This logic was moved back to dimensions as width/height handle the window and document there as well.
edb2286
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They may not technically make sense at a very low level, but they certainly make sense at a high level. Ignoring the fact that you can't put a border on the window, the conceptual outer width of the window still exists, it just happens to always be equal to its width.
The only reason I could see us arguing against adding support for this is that it would degrade performance on regular element. But I don't think that a case can be made that a single property check would be problematic.