What is the replacement for layerX and layerY?

1,283 views
Skip to first unread message

Peng Yu

unread,
Jan 8, 2012, 2:30:03 AM1/8/12
to Google Chrome Developer Tools
Hi,

I see the following warnings in devtools. Does anybody know what
variables I should use to replace layerX and layerY? Thanks!

"event.layerX and event.layerY are broken and deprecated in WebKit.
They will be removed from the engine in the near future."

Regards,
Peng

Sam Dutton

unread,
Jan 8, 2012, 2:40:57 AM1/8/12
to Peng Yu, Google Chrome Developer Tools

Hi Peng

Install jQuery 1.7, I think 1.7.2.

Sam

Peng Yu

unread,
Jan 8, 2012, 8:19:52 AM1/8/12
to Sam Dutton, Google Chrome Developer Tools
Hi,

> Install jQuery 1.7, I think 1.7.2.

I do see there is this problem with earlier version of jQuery.

But I'm not using jQuery at all. I'm wondering you recommend me to
install jQuery 1.7.2. Are you assuming that my problem is due to
jQuery?

--
Regards,
Peng

PhistucK

unread,
Jan 8, 2012, 8:51:11 AM1/8/12
to Peng Yu, Sam Dutton, Google Chrome Developer Tools
Yes, jQuery (up until 1.7.2, not including) used layerX/layerY, or at least copied these properties from the original event object, which caused the warnings to appear.

PhistucK

Peng Yu

unread,
Jan 8, 2012, 8:53:22 AM1/8/12
to PhistucK, Sam Dutton, Google Chrome Developer Tools
> Yes, jQuery (up until 1.7.2, not including) used layerX/layerY, or at least
> copied these properties from the original event object, which caused the
> warnings to appear.

Since I'm not using jQuery, is there anything else from the event
object that I can use to get the same values as layerX/layerY?

--
Regards,
Peng

Sam Dutton

unread,
Jan 8, 2012, 9:41:01 PM1/8/12
to Peng Yu, PhistucK, Google Chrome Developer Tools
Hi Peng 

Sorry -- I just assumed you were referring to the jQuery problem.

If you don't want to use a library, you can use event,pageX, event.screenX and event.x along with other values to get the offset you want (as discussed here). 

Sam
Reply all
Reply to author
Forward
0 new messages