开发者

Rhino JS, error in declaration?

I'm trying to use CSSParser (0.9.5) from Rhino. The documentation seems to be lacking, but I found this sample code that makes sense to me.

But when I try, with Rhino 1.7R2:

js> var is = new java.io.FileInputStream("style.css");
js> var r = new java.io.InputStreamReader(is);
js> var source = new Packages.org.w3c.css.sac.InputSource(r);
js> var parser = new Packages.com.steadystate.css.parser.CSSOMParser();
js> parser
com.steadystate.css.parser.CSSOMParser@d24e3f
js> parser.parseStyleDeclaration
function parseStyleDeclaration() {/*
org.w3c.dom.css.CSSStyleDeclaration parseStyleDeclaration(org.w3c.css.sac.InputSource)
void parseStyleDeclaration(org.w3c.dom.css.CSSStyleDeclaration,org.w3c.css.sac.InputSource)
*/}

js> parser.pa开发者_运维问答rseStyleDeclaration(source);
null [1:4] Error in declaration. Invalid token ".". Was expecting one of: <S>, ":".

Since there's 2 ways to call parseStyleDeclaration, I also tried the other one:

(same as above, but then)

js> var style = new Packages.com.steadystate.css.dom.CSSStyleDeclarationImpl();
js> parser.parseStyleDeclaration(style, source);
null [1:4] Error in declaration. Invalid token ".". Was expecting one of: <S>, ":".

It's probably something simple I'm forgetting. But what?


Never mind, I'm an idiot.

It's a CSSParser error, not a Rhino error.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜