Opened 11 years ago
Last modified 5 years ago
#10724 assigned defect
dojo.position return different values on WebKit based platforms
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Milestone: | 1.15 |
Component: | HTML | Version: | 1.4.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Steps:
- Create a group shape -> shape = owner.createGroup();
- transform the shape (x, y) ->
shape.setTransform(null); var matrix = { xx: 1.0, yy: 1.0, dx: 100, dy: 100 }; shape.setTransform(matrix);
- Query for it's position -> dojo.position(shape.rawNode, true);
In FireFox? it returns the translated value relative to it's parent. In WebKit? browsers (Safari / Chrome) it is unchanged.
Change History (9)
comment:1 follow-up: 2 Changed 11 years ago by
Owner: | changed from anonymous to davidmark |
---|---|
Status: | new → assigned |
comment:2 Changed 11 years ago by
Replying to davidmark:
What version(s) of Safari and FF? Makes a huge difference for dojo.position (e.g. may or may not be using getBoundingClientRect).
Browser sniffing may be the culprit as well.
Of course, the function is all tangled up with browser sniffing. Each sniff is a placeholder for a problem that was never properly investigated, diagnosed or solved.
if(node["getBoundingClientRect"]){ // IE6+, FF3+, super-modern WebKit, and Opera 9.6+ all take this branch ret = node.getBoundingClientRect(); ret = { x: ret.left, y: ret.top, w: ret.right - ret.left, h: ret.bottom - ret.top }; //>>excludeStart("webkitMobile", kwArgs.webkitMobile); if(d.isIE){ // On IE there's a 2px offset that we need to adjust for, see _getIeDocumentElementOffset() var offset = d._getIeDocumentElementOffset(); // fixes the position in IE, quirks mode ret.x -= offset.x + (d.isQuirks ? db.clientLeft+db.offsetLeft : 0); ret.y -= offset.y + (d.isQuirks ? db.clientTop+db.offsetTop : 0); }else if(d.isFF == 3){ // In FF3 you have to subtract the document element margins. // Fixed in FF3.5 though. var cs = gcs(dh); ret.x -= px(dh, cs.marginLeft) + px(dh, cs.borderLeftWidth); ret.y -= px(dh, cs.marginTop) + px(dh, cs.borderTopWidth); } //>>excludeEnd("webkitMobile"); }else{ // FF2 and older WebKit
Of course, the documentElement should _never_ have margins (think about what that would look like.)
The IE quirks mode stuff is wrong too, but that is irrelevant here.
So, is it a "super modern" WebKit? that is giving you problems?
comment:3 Changed 11 years ago by
Owner: | changed from davidmark to anonymous |
---|---|
Status: | assigned → new |
comment:4 Changed 10 years ago by
Owner: | changed from anonymous to Eugene Lazutkin |
---|---|
Status: | new → assigned |
More reports: http://article.gmane.org/gmane.comp.web.dojo.user/53293
comment:5 Changed 10 years ago by
Component: | General → Core |
---|
comment:7 Changed 9 years ago by
Component: | Core → HTML |
---|
comment:8 Changed 5 years ago by
Milestone: | tbd → 1.12 |
---|---|
Owner: | Eugene Lazutkin deleted |
Consider cleaning this code up for 1.12.
comment:9 Changed 5 years ago by
Milestone: | 1.13 → 1.15 |
---|
Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.
What version(s) of Safari and FF? Makes a huge difference for dojo.position (e.g. may or may not be using getBoundingClientRect).
Browser sniffing may be the culprit as well.