I was using the drag-n-drop feature of the Rico Ajax library the other day and noticed that the feature was not working in Internet Explorer, where I was getting this error:
Microsoft JScript runtime error: 'document.defaultView' is null or not an object
In Firefox, I was seeing this error in the Javascript console:
Error: [Exception... "Could not convert JavaScript argument arg 0 [nsIDOMViewCSS.getComputedStyle]" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://localhost/Ajax/AjaxJSLibs/rico.js :: anonymous :: line 2644" data: no]
Source File: http://localhost/Ajax/AjaxJSLibs/rico.js
Line: 2644
Upon closer inspection, I noticed that the problem was buried deep inside of a Rico utility function that was using introspection to set HTML element properties. I realized that it was trying to work with the background-color style for the element, but this was not set in my CSS for the element, so it was referencing a null value. The fix was to make sure that the elements that are set up as the Rico draggables and dropzones have the CSS background-color property set.
This makes sense, once I realized what was going on. The background color changes for both the dragged item and the drop zones while the item is dragged. The Rico library needs to save the original background color so that it can be reset once the dragging is done.
So, when using the Rico drag-n-drop feature, make sure you set the background-color style for the draggable and dropzone HTML elements.
Read More...
[Source: Stuart Jones Weblog - Posted by Kishore Vengala]
No comments:
Post a Comment