From: Antoine Q. <an...@gr...> - 2001-09-28 15:35:25
|
> > First off, we need a method to give a string access to this > interface's > > methods. Like > > > > var string = 'fill: red; opacity: 1'; > > var CSSString = doc.createCSSStyleDeclaration(string); > > We need create* (preferably on CSSImplementation, or on > specific Factory > interfaces) for everything (SAC has those). Your above > example could be a > shortcut, but I would much prefer: > > // RGBCOLOR and REAL are constants defined in SAC > var CSSDecl = factory.createCSSStyleDeclaration(); > var redLU = factory.createCSSLexicalUnit(RGBCOLOR, 'red'); > var CSSDecl.addProperty( > factory.createCSSPropertyValue('fill', redLU) ); > var opaLU = factory.createCSSLexicalUnit(REAL, 1); > var CSSDecl.addProperty( > factory.createCSSPropertyValue('opacity',opaLU) ); Well, it's good to have these too. My example is not simply shortcut to your piece of code. We need a Create* method taking a string as a parameter so that any string, possibly one read in a non-"style" attribute like in iDrag, can benefit from the CSSStyleDeclaration interface. It would allow us for parsing such a string, your example relies on the string being parsed already really. But what's in your example is required too since we need to be able to create style objects in such a verbose way too. We just need both really. Antoine |