[gwt-contrib] Re: Add StyleInjector to GWT trunk

2009-04-06 Thread BobV
StyleInjector committed to trunk at r5185. @RayC, I added an assertion that there is a head tag. @RayR, The line lengths seem to be ok according to the eclipse formatting rules checked into trunk. I added notes to the Javadoc indicating that not all StyleElements returned are necessarily u

[gwt-contrib] Re: Add StyleInjector to GWT trunk

2009-04-04 Thread Miroslav Pokorny
Using individual rules naturally has pluses and minuses. In this case in which one wants to add rules on mass it's not appropriate thus appending new css to a particular stylesheet is more appropriateread on for my views and some developer benefits. Take the stylesheet included by one of

[gwt-contrib] Re: Add StyleInjector to GWT trunk

2009-04-03 Thread Ray Cromwell
The current solution of allowing you to inject as the first child of works just fine, at the loss of user defined stylesheets needing to use !important, but it is also extremely simple to implement, and the low hanging fruit. Iimposing that StyleInjector would have to use addRule()/insertRule() wo

[gwt-contrib] Re: Add StyleInjector to GWT trunk

2009-04-03 Thread Miroslav Pokorny
That's correct because they cascade. The benefit of specifying which stylesheet to inject into is that the gwt stylesheet can contain defaults which are in turn overridden at will in user defined stylesheets. Currently it's a free for all with ordering being undpecified which makes it mess

[gwt-contrib] Re: Add StyleInjector to GWT trunk

2009-04-03 Thread Ray Cromwell
You can get the CssRule/CSSStyleDeclaration as text via the cssText property, but AFAIK, there is no property on document.styleSheets[n] that allows setting the whole stylesheet at once using text. If there is, it's certainly not part of the W3C DOM CSS OM. -Ray On Fri, Apr 3, 2009 at 8:21 PM, Mir

[gwt-contrib] Re: Add StyleInjector to GWT trunk

2009-04-03 Thread Miroslav Pokorny
One does not have to add the rules one by one. If I recall it is possible to get the entire content of a stylesheet using the "css" property append your new rules and update that property. I'm pretty sure you can do basically the same thing in all browsers. Ti On 04/04/2009, at 10:56 AM, Ra

[gwt-contrib] Re: Add StyleInjector to GWT trunk

2009-04-03 Thread Ray Cromwell
It seems to me that calling addRule/insertRule a hundred times would be pretty slow (just look how many rules are in the GWT Theme CSS), not to mention there are cross-browser issues to deal with, when a simple, well-tested, mechanism exists already. Sometimes doing the 'proper' thing is not an imp

[gwt-contrib] Re: Add StyleInjector to GWT trunk

2009-04-03 Thread Miroslav Pokorny
This is probably the wrong time to ask -but updating styles via the addition of style tags seems very limiting. If I recall IE (cant recall which vetsion was probably 7) chokes when a page has more than thirty odd style elements. Why not add new rules using StyleSheet.addRule/insertRule or ap

[gwt-contrib] Re: Add StyleInjector to GWT trunk

2009-04-03 Thread Ray Cromwell
I believe so. I don't see any harm. Personally, I think if you don't have a , your page is broken, since you don't even get a , but it would be nice to either throw an informative exception, or inject a head in this circumstance. -Ray On Fri, Apr 3, 2009 at 2:46 PM, Ray Ryan wrote: > Can we add

[gwt-contrib] Re: Add StyleInjector to GWT trunk

2009-04-03 Thread Ray Ryan
Can we add safely add head if we don't find it? On Fri, Apr 3, 2009 at 2:43 PM, wrote: > > http://gwt-code-reviews.appspot.com/15803/diff/4001/4004 > File user/src/com/google/gwt/dom/client/StyleInjector.java (right): > > http://gwt-code-reviews.appspot.com/15803/diff/4001/4004#newcode35 > Line

[gwt-contrib] Re: Add StyleInjector to GWT trunk

2009-04-03 Thread cromwellian
http://gwt-code-reviews.appspot.com/15803/diff/4001/4004 File user/src/com/google/gwt/dom/client/StyleInjector.java (right): http://gwt-code-reviews.appspot.com/15803/diff/4001/4004#newcode35 Line 35: "head").getItem(0)); I mentioned this in another review, but this common idiom can fail if the

[gwt-contrib] Re: Add StyleInjector to GWT trunk

2009-04-03 Thread rjrjr
LGTM Some nits, do with them what you will and commit this puppy. http://gwt-code-reviews.appspot.com/15803/diff/4001/4004 File user/src/com/google/gwt/dom/client/StyleInjector.java (right): http://gwt-code-reviews.appspot.com/15803/diff/4001/4004#newcode35 Line 35: "head").getItem(0)); line t

[gwt-contrib] Re: Add StyleInjector to GWT trunk

2009-04-02 Thread Ray Cromwell
Bob, The issue for me was follows: I used StyleInjector in Chronoscope to inject default styles/themes for some Widgets. Users of my library complained that they could not include their own css stylesheet to override some of these, the reason is, the injected stylesheet always appears after all li

[gwt-contrib] Re: Add StyleInjector to GWT trunk

2009-04-02 Thread bobv
[+Ray Cromwell] @RayC, What was the exact problem that you were having without an insertBefore/After method? These methods are somewhat problematic to implement in a least-surprise way on IE owing to the pigeonhole principle unless the API is changed to return some kind of token instead of a

[gwt-contrib] Re: Add StyleInjector to GWT trunk

2009-04-01 Thread Ray Ryan
That's a rather lawyerly interpretation of the very minimal javadoc. You've given me a method that says "give me a style element and I'll insert this code after it," which strongly implies that you'll do your best to insert the code right after it, not all the way at the end of the head. You're re

[gwt-contrib] Re: Add StyleInjector to GWT trunk

2009-04-01 Thread bobv
http://gwt-code-reviews.appspot.com/15803/diff/1/4 File user/src/com/google/gwt/dom/client/StyleInjector.java (right): http://gwt-code-reviews.appspot.com/15803/diff/1/4#newcode42 Line 42: return injectStyleSheet(contents); On 2009/04/01 20:05:03, rjrjr wrote: > Your public api implies promises

[gwt-contrib] Re: Add StyleInjector to GWT trunk

2009-04-01 Thread rjrjr
http://gwt-code-reviews.appspot.com/15803/diff/1/4 File user/src/com/google/gwt/dom/client/StyleInjector.java (right): http://gwt-code-reviews.appspot.com/15803/diff/1/4#newcode42 Line 42: return injectStyleSheet(contents); You're ignoring element. How can you get away with that? Your public ap