diff options
author | Valerio Virgillito | 2012-02-02 00:11:51 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-02 00:11:51 -0800 |
commit | 5a305ec44b2bd5198a248357439aae8ebbd75fee (patch) | |
tree | ec3b756beab7105841353ef79d4e8059b2b6a91c /node_modules/montage/ui/dom.js | |
parent | dbe9c7705860fb3551321e23e7eab763f622241c (diff) | |
download | ninja-5a305ec44b2bd5198a248357439aae8ebbd75fee.tar.gz |
upgrading to Montage v0.6
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'node_modules/montage/ui/dom.js')
-rwxr-xr-x | node_modules/montage/ui/dom.js | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/node_modules/montage/ui/dom.js b/node_modules/montage/ui/dom.js index 158b8a8f..f629ff18 100755 --- a/node_modules/montage/ui/dom.js +++ b/node_modules/montage/ui/dom.js | |||
@@ -220,8 +220,7 @@ try { | |||
220 | _webKitPoint = new WebKitPoint(0,0); | 220 | _webKitPoint = new WebKitPoint(0,0); |
221 | } catch (e) {} | 221 | } catch (e) {} |
222 | 222 | ||
223 | if (_webKitPoint) { | 223 | var webkitImplementation = function() { |
224 | |||
225 | exports.convertPointFromNodeToPage = function(element, point) { | 224 | exports.convertPointFromNodeToPage = function(element, point) { |
226 | if(point) { | 225 | if(point) { |
227 | _webKitPoint.x = point.x; | 226 | _webKitPoint.x = point.x; |
@@ -230,8 +229,8 @@ if (_webKitPoint) { | |||
230 | _webKitPoint.x = 0; | 229 | _webKitPoint.x = 0; |
231 | _webKitPoint.y = 0; | 230 | _webKitPoint.y = 0; |
232 | } | 231 | } |
233 | _webKitPoint = webkitConvertPointFromNodeToPage(element, _webKitPoint); | 232 | point = webkitConvertPointFromNodeToPage(element, _webKitPoint); |
234 | return Point.create().init(_webKitPoint.x, _webKitPoint.y); | 233 | return point ? Point.create().init(point.x, point.y) : null; |
235 | }; | 234 | }; |
236 | 235 | ||
237 | exports.convertPointFromPageToNode = function(element, point) { | 236 | exports.convertPointFromPageToNode = function(element, point) { |
@@ -242,13 +241,15 @@ if (_webKitPoint) { | |||
242 | _webKitPoint.x = 0; | 241 | _webKitPoint.x = 0; |
243 | _webKitPoint.y = 0; | 242 | _webKitPoint.y = 0; |
244 | } | 243 | } |
245 | _webKitPoint = webkitConvertPointFromPageToNode(element, _webKitPoint); | 244 | point = webkitConvertPointFromPageToNode(element, _webKitPoint); |
246 | return Point.create().init(_webKitPoint.x, _webKitPoint.y); | 245 | return point ? Point.create().init(point.x, point.y) : null; |
247 | }; | 246 | }; |
248 | 247 | }; | |
249 | } else { | 248 | var shimImplementation = function() { |
250 | |||
251 | exports.convertPointFromNodeToPage = function(element, point) { | 249 | exports.convertPointFromNodeToPage = function(element, point) { |
250 | if (!element || typeof element.x !== "undefined") { | ||
251 | return null; | ||
252 | } | ||
252 | var offset; | 253 | var offset; |
253 | if (offset =_offsetForElement(element)) { | 254 | if (offset =_offsetForElement(element)) { |
254 | return Point.create().init((point ? point.x:0)+offset.left, (point ? point.y:0)+offset.top); | 255 | return Point.create().init((point ? point.x:0)+offset.left, (point ? point.y:0)+offset.top); |
@@ -258,6 +259,9 @@ if (_webKitPoint) { | |||
258 | }; | 259 | }; |
259 | 260 | ||
260 | exports.convertPointFromPageToNode = function(element, point) { | 261 | exports.convertPointFromPageToNode = function(element, point) { |
262 | if (!element || typeof element.x !== "undefined") { | ||
263 | return null; | ||
264 | } | ||
261 | var offset; | 265 | var offset; |
262 | if (offset =_offsetForElement(element)) { | 266 | if (offset =_offsetForElement(element)) { |
263 | return Point.create().init((point ? point.x:0)-offset.left, (point ? point.y:0)-offset.top); | 267 | return Point.create().init((point ? point.x:0)-offset.left, (point ? point.y:0)-offset.top); |
@@ -265,4 +269,10 @@ if (_webKitPoint) { | |||
265 | return Point.create().init((point ? point.x:0), (point ? point.y:0)); | 269 | return Point.create().init((point ? point.x:0), (point ? point.y:0)); |
266 | } | 270 | } |
267 | }; | 271 | }; |
268 | } \ No newline at end of file | 272 | }; |
273 | |||
274 | if (_webKitPoint) { | ||
275 | webkitImplementation(); | ||
276 | } else { | ||
277 | shimImplementation(); | ||
278 | } | ||