I am having difficulty getting these lines to validate using JSLint. I'm assuming (perhaps incorrectly) that they are actually valid. Here is the relevant code:
var shadowBox = $('<div/>').appendTo($(document.body));
// ...
shadowBox.css({
left: (e.originalEvent.clientX + 10).toString() + 'px',
top: e.originalEvent.clientY.toString() + 'px'
});
The validation errors I am getting are:
Problem at line 492 character 22: Type confusion: function and .css: object.
shadowBox.css({
and
Problem at line 494 character 57: Type confusion: number and '+': string.
top: e.originalEvent.clientY.toString() + 'px'
I'm troubled more by the first one as that is a rather common jQuery syntax. The second seems like a false positive since I am concatenating string with string.
Thanks
EDIT
Figured out the problem:
Turns out JSLint is not happy with these two syntax patterns existing in the same document:
var $var = $('<div/>', {css: {width: '15px'}}); // ONE
$var.css({width : '20px'}); // TWO