[Webkit-unassigned] [Bug 15862] pixelTop, pixelLeft, pixelWidth, pixelHeight: values should be number, not empty string

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Nov 12 00:16:00 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=15862





--- Comment #3 from Garrett Smith <dhtmlkitchen at gmail.com>  2011-11-12 00:16:01 PST ---
(In reply to comment #2)
> These props were from an IE standard.
> 
> http://msdn.microsoft.com/en-us/library/ms531133%28v=vs.85%29.aspx
> 
Yep.

In a nutshell, my argument is that WebKit's implementation of pixelTop and friends should work just like Microsoft's or should not exist at all.

They're diffrerent from the IE versions and potentially cause more harm than good. Perhaps removal is a better option.

> DOM Level 2 recommends using: document.body.style.top

Totally different. pixelTop represents pixel value, rounded to a number. style.top is a string and a css length (em, %, etc).

> 
> This document has some recommendations for replacements for these IE specific props. 
> https://developer.mozilla.org/en/Using_Web_Standards_in_your_Web_Pages/Using_the_W3C_DOM
> 
> Is there a specific reason why you need them?
To get a pixel value. Though we can now get that from getBoundingClientRect. 

What is the justification for having a Microsoft property that works differently than Microsoft's definition of it? Seems like a mistake, no?

It is as if those properties were added for compatibility, but that there was a poor effort made to make these properties actually compatible with the Microsoft properties of the same names. That is why I suggested that these properties be fixed to match Microsoft's behavior. Here is an example that demonstrates some incompatibility:


if(document.body.style.pixelTop == 0) {
  // Code that works with pixelTop
}

When pixelTop is 0 or "", it is equal to 0, thus, the code will run in WebKit. This is a problem because WebKit's pixelTop works differently than Microsoft's. 

WebKit should either remove the "pixelTop and friends" properties or follow Microsoft's respective definitions of them. Making them strings seems not only useless but potentially harmful, as they could trip up a script that uses a feature check, as shown in the above example, having unexpected, divergent behavior in WebKit.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list