Bug Tracker

Opened 12 years ago

Closed 12 years ago

#1914 closed bug (fixed)

elem.style has no properties

Reported by: Digi Owned by:
Priority: major Milestone: 1.2.2
Component: core Version: 1.2.1
Keywords: Cc:
Blocked by: Blocking:

Description

Hello,

In firefox, when calling offset() from the dimensions pluggin, I occasionally get the error "elem.style has no properties http://hacksim.metalaxe.com/testing/exploitos/jquery/jquery.js Line 698". This error happens every time when using IE7 as a browser. The error originates from a call to offset() on line 255 of battleship.js.

Test case can be found at: http://hacksim.metalaxe.com/testing/programs/battleship/battlefield.html

To duplicate, especially in IE7, drag a ship from the right on to the grid in the "droppable" td's.

I've also attached battleship.js, battlefield.html and style.css for local testing. I'm using the SVN version of jquery.ui REV 3807

Attachments (3)

battleship.js (7.1 KB) - added by Digi 12 years ago.
main javascript file for program operation
battlefield.html (6.3 KB) - added by Digi 12 years ago.
display page
style.css (1.1 KB) - added by Digi 12 years ago.
required styles

Download all attachments as: .zip

Change History (6)

Changed 12 years ago by Digi

Attachment: battleship.js added

main javascript file for program operation

Changed 12 years ago by Digi

Attachment: battlefield.html added

display page

Changed 12 years ago by Digi

Attachment: style.css added

required styles

comment:1 Changed 12 years ago by Digi

I forgot to mention. I'm using jquery core dated 2007-09-16 23:42:06 -0400 (Sun, 16 Sep 2007) and jquery.dimensions dated 2007-09-11 02:38:31 +0000 (Tue, 11 Sep 2007)

Thank you.

comment:2 Changed 12 years ago by Digi

Here's some backtrace information. I noticed that, for whatever reason, the element it is trying to access is the document itself. The line it is refering to in battleship.js (the version of this back trace) is as follows (jquery_ui is the second argument in findCell). Let me know if you need more information.

battleship.js (line 381-2) var droppable = jquery_ui.draggable.currentTarget; var droppable_inset_x = $(droppable).offset().left;

elem.style has no properties curCSS(Document battlefield.html, "position", undefined)jquery.js (line 698) css(Document battlefield.html, "position")jquery.js (line 675) offset()jquery.js (line 2908) findCell(Object type=drop target=img#bb.ships, Object draggable=Object droppable=Object)battleship.js (line 382) placePlayerShip(Object type=drop target=img#bb.ships, Object draggable=Object droppable=Object)battleship.js (line 268) drop(Object type=drop target=img#bb.ships, Object draggable=Object droppable=Object)battleship.js (line 152) trigger("drop", [Object type=drop target=img#bb.ships, Object draggable=Object droppable=Object], div.grid, false, function())jquery.js (line 1739) triggerHandler("drop", [Object type=drop target=img#bb.ships, Object draggable=Object droppable=Object], function())jquery.js (line 1885) drop(Object type=drop target=img#bb.ships)ui.droppable.js (line 149) (no name)(Object item=Object over=1 out=0 offset=Object)ui.draggable.js (line 47) grep([Object item=Object over=1 out=0 offset=Object, Object item=Object over=0 out=1 offset=Object], function(), undefined)jquery.js (line 981) fire(Object element=img#bb.ships options=Object opos=[2] pos=[2], Object type=drop target=img#bb.ships)ui.draggable.js (line 44) stop(Object interaction=Object plugins=Object, Object type=drop target=img#bb.ships)ui.draggable.js (line 154) _beforeStop(img#bb.ships v_battleship.png, [327, 270], Object top=17 left=13 bottom=18 right=0, Object element=img#bb.ships options=Object opos=[2] pos=[2], Object type=drop target=img#bb.ships)ui.draggable.js (line 89) stop(Object type=drop target=img#bb.ships)ui.mouse.js (line 195) mouseup(Object type=drop target=img#bb.ships)ui.mouse.js (line 115) handle(Object type=drop target=img#bb.ships)jquery.js (line 1776) (no name)()jquery.js (line 1620) [Break on this error] if (!force && elem.style[prop])

comment:3 Changed 12 years ago by brandon

Priority: blockermajor
Resolution: fixed
Status: newclosed

It looks like your app is trying to get the offset of the document instead of an element and that is what is causing the error.

Hope to be able to see a finished version!

Note: See TracTickets for help on using tickets.