I'm using Ajax to retrieve multiple CSS files, each dedicated to a single
media query. or each one, I then wrap the appropriate media query around
the contents, and then inject it via StyleInjector.injectAtEnd.
The page the app is running has a whole pile of stuff going on, including
scripts related to social network sharing.
We've run into two issues:
1. The media queries don't seem to be applied, although IE9-10's dev tools
are hinky enough that this may not actually be the problem
2. Image urls in the CSS sometimes get applied as if they came from some
other domain, in this particular case, one of the social media ones.
I believe that the issue is in StyleInjector.StyleInjectorImplIE, at the
end:
@Override
public StyleElement injectStyleSheetAtEnd(String contents) {
int documentStyleCount = getDocumentStyleCount();
if (documentStyleCount == 0) {
return createNewStyleSheet(contents);
}
return appendToStyleSheet(documentStyleCount - 1, contents, true);
}
Where the style element it chooses to add to is likely to be one of the
foreign ones, especially since the social media scripts tend to run late in
the load process. It looks like IE exposes the href of the CSS, so this
could be checked.
So, I'm going to try changing it to use injectStylesheet, which looks like
it chooses the shortest to add to if there are already 30 in place (but
isn't that going to affect ordering of the rules?)
I would try to write an extension of StyleInjectorImplIE, except that, like
many GWT classes, it isn't extensible. I've finally gotten annoyed enough
at that to write a separate post about it.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.