jQuery 1.7 - Cannot set property cssText #356

Closed
braddunbar opened this Issue Nov 6, 2011 · 5 comments

Projects

None yet

4 participants

@braddunbar

Using the following, I am receiving an error using jQuery 1.7:

test.html

<!doctype html>
<html>
<head>
  <script src='http://code.jquery.com/jquery-1.7.js'></script>
</head>
<body>
</body>
</html>

test.js

#!/usr/bin/env node

var fs = require('fs');
var jsdom = require('jsdom').jsdom;

var window = jsdom(fs.readFileSync('test.html')).createWindow();

window.onload = function(){
  console.log('loaded');
};

The error I receive is:

TypeError: Cannot set property cssText of [object Object] which has only a getter
    at Object.<anonymous> (http://code.jquery.com/jquery-1.7.js:1621:27)
    at Object.<anonymous> (http://code.jquery.com/jquery-1.7.js:1064:30)
    at Object.fireWith (http://code.jquery.com/jquery-1.7.js:1182:7)
    at Function.ready (http://code.jquery.com/jquery-1.7.js:437:14)
    at Object.<anonymous> (http://code.jquery.com/jquery-1.7.js:927:10)
    at Function.dispatch (/Users/brad/dev/test/node_modules/jsdom/lib/jsdom/level2/events.js:195:42)
    at Object.dispatchEvent (/Users/brad/dev/test/node_modules/jsdom/lib/jsdom/level2/events.js:285:33)
    at Object.<anonymous> (/Users/brad/dev/test/node_modules/jsdom/lib/jsdom/level2/html.js:391:12)
    at /Users/brad/dev/test/node_modules/jsdom/lib/jsdom/level2/html.js:48:20
    at Object.check (/Users/brad/dev/test/node_modules/jsdom/lib/jsdom/level2/html.js:277:11)

I think this is because CSSOM doesn't define a setter for cssText.

@tmpvar
Owner
tmpvar commented Nov 9, 2011

makes sense, could you raise this issue with the CSSOM project?

@paulmillr

@tmpvar this situation is kinda very bad -- all my projects that depend on jsdom are broken now. Even though they're all using stable versions of libs.

I propose to change dependency format in package json from "cssom" : ">=0.2.0", to "cssom" : "0.2.0", to prevent this thing. This includes all other dependencies.

@papandreou
Contributor

@paulmillr I tried reproducing this problem with jsdom 0.2.9 and CSSOM 0.2.0, but your test doesn't fail for me, it just outputs "loaded". Maybe you're working with an older (or patched) jsdom?

CSSOM 0.2.1 was just released and it implements a CSSStyleDeclaration.cssText setter. Could you check whether that fixes the problem for you?

@paulmillr

@papandreou yea, I've already upgraded to 0.2.1, it fixes that bug.

@papandreou
Contributor

Awesome, please close this issue then :)

@tmpvar tmpvar closed this Nov 21, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment