Can somebody help me out? I do appreciate it.

On Sunday, April 10, 2016 at 10:10:13 AM UTC+8, David wrote:
>
> I have an original html like below:
>
> <html>
>   <head/>
>   <frameset>
>     <frame>
>       <html>
>         <head>
>        
>         </head>
>         <body>
>         </body>
>      </frame>
>      <frame>
>       <html>
>         <head>
>        
>         </head>
>         <body>
>         </body>
>      </frame>
>      <frame>
>       <html>
>         <head>
>        
>         </head>
>         <body>
>         </body>
>      </frame>
> </frameset>
> </html>
>
> I must use GWT for this original html. I can use GWT.create() 
> and CssResource.ensureInjected() to inject css into top <head>. Because the 
> injected css is not available for frame, I have to inject these css into 
> frame. I don't know why the following code doesn't work:
>
> ClientBundle globalClientBundle = GWT.create(GlobalClientBundle.class);
> globalClientBundle.css().ensureInjected();
> NodeList<Element> frameNodeList = document.getElementsByTagName("frame");
> int length = frameNodeList.getLength();
> logger.info("frame size=" + length);
> for (int i=0; i<length; i++) {
> FrameElement frameElement = (FrameElement)frameNodeList.getItem(i);
> logger.info("Frame(id=" + frameElement.getId() + ", name=" + 
> frameElement.getName() + ")");
> Document ownerDocument = frameElement.getOwnerDocument();
> HeadElement head = ownerDocument.getHead();
> if (head != null) {
> StyleElement styleElement = ownerDocument.createStyleElement();
> HeadElement.as(head).appendChild(styleElement);
> String cssText = globalClientBundle.css().getText();
> styleElement.setInnerHTML(cssText);
>
> logger.info("Inject css into frame");
> }
> }
>
> The above code is executing well. But I cannot see any <style> in html 
> code.
>
> Thanks,
>
> David
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" 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 https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to