Example #1
0
 private void investigateLinkElement(HtmlLinkElement element)
 {
     if (styleExtensionManager.parsingNeeded( element )) {
         styleExtensionManager.parseAndReleaseLinkElement(element);
     }
 }
        JsString resetLinkAndReturnURL(HtmlLinkElement link)
        {
            //reset it and let the browser handle it now, we have the url we need
            //we will grab it next. So long as we are caching files, it will be retrieved synchronoulsy from the cache
            link.rel = "stylesheet";

            return link.href;
        }
 public void parseAndReleaseLinkElement(HtmlLinkElement element)
 {
     resolveSheet(resetLinkAndReturnURL(element));
 }
        //TODO consider moving this somewhere more appropriate
        /*
        public StyleExtensionMapEntry getMergedEntryForElement(HtmlElement element) {
            JsString cssClassList = element.getAttribute("class");
            StyleExtensionMapEntry mergedEntry = null;

            if (cssClassList != null) {
                var cssClassArray = cssClassList.split(" ");
                for (int i = 0; i < cssClassArray.length; i++) {
                    var cssClass = cssClassArray[i].As<JsString>();
                    var extensionMapEntry = map.getExtensionEntry(cssClass);

                    if (extensionMapEntry != null) {
                        if (mergedEntry == null) {
                            //Waiting as long as we can to instantiate
                            mergedEntry = new StyleExtensionMapEntry();
                        }

                        extensionMapEntry.mergeTo(mergedEntry);
                    }
                }
            }

            return mergedEntry;
        }*/
        public bool parsingNeeded(HtmlLinkElement link)
        {
            return ( link.rel == "stylesheet/randori" );
        }
 private void investigateLinkElement(HtmlLinkElement element)
 {
     if (styleExtensionManager.parsingNeeded( element )) {
         styleExtensionManager.parseAndReleaseLinkElement(element);
         //we must rebuild our stylemanager cache if we find a style sheet in this walk. Do so from our entryElement
         extensionsToBeApplied = styleExtensionManager.getExtensionsForFragment(entryElement);
     }
 }