Skip to content

Commit

Permalink
remove code to detect 3D CSS support on WebKit because of side effect…
Browse files Browse the repository at this point in the history
…s; just use normal scale CSS instead. Fixes madrobby#377
  • Loading branch information
madrobby committed Apr 5, 2012
1 parent 72b9513 commit a38473c
Showing 1 changed file with 2 additions and 28 deletions.
30 changes: 2 additions & 28 deletions src/fx_methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
if (typeof speed == 'function' && !callback) callback = speed, speed = undefined
var props = { opacity: opacity }
if (scale) {
if ($.fx.transforms3d) props.scale3d = scale + ',1'
else props.scale = scale
props.scale = scale
el.css($.fx.cssPrefix + 'transform-origin', '0 0')
}
return el.anim(props, translateSpeed(speed) / 1000, null, callback)
Expand Down Expand Up @@ -67,32 +66,7 @@
}

$.extend($.fx, {
speeds: speeds,
// feature detection for 3D transforms adapted from Modernizr
transforms3d: (function(props){
var ret = false
$.each(props, function(i, prop){
if (docElem.style[prop] !== undefined) {
ret = i != 1 || webkitTransforms3d()
return false
}
})
return ret
})('perspectiveProperty WebkitPerspective MozPerspective OPerspective msPerspective'.split(' '))
speeds: speeds
})

function webkitTransforms3d() {
var ret, div = document.createElement('div'),
testEl = document.createElement('div'),
css = '@media (-webkit-transform-3d){#zeptotest{left:9px;position:absolute}}',
style = ['&shy;', '<style>', css, '</style>'].join('')

div.innerHTML += style
testEl.id = 'zeptotest'
div.appendChild(testEl)
docElem.appendChild(div)
ret = testEl.offsetLeft === 9
div.parentNode.removeChild(div)
return ret
}
})(Zepto)

0 comments on commit a38473c

Please sign in to comment.