Class ScriptElementSupport


  • public final class ScriptElementSupport
    extends java.lang.Object
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    A helper class to be used by elements which support ScriptElement.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void executeScriptIfNeeded​(DomElement element, boolean ignoreAttachedToPage, boolean ignorePageIsAncestor)
      INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
      Executes this script node if necessary and/or possible.
      static boolean isJavaScript​(DomElement element, java.lang.String typeAttribute, java.lang.String languageAttribute)
      Returns true if a script with the specified type and language attributes is actually JavaScript.
      static void onAllChildrenAddedToPage​(DomElement element, boolean postponed)
      Lifecycle method invoked after a node and all its children have been added to a page, during parsing of the HTML.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • onAllChildrenAddedToPage

        public static void onAllChildrenAddedToPage​(DomElement element,
                                                    boolean postponed)
        Lifecycle method invoked after a node and all its children have been added to a page, during parsing of the HTML. Intended to be overridden by nodes which need to perform custom logic after they and all their child nodes have been processed by the HTML parser. This method is not recursive, and the default implementation is empty, so there is no need to call super.onAllChildrenAddedToPage() if you implement this method.
        Parameters:
        element - the element
        postponed - whether to use PostponedAction or no
      • executeScriptIfNeeded

        public static void executeScriptIfNeeded​(DomElement element,
                                                 boolean ignoreAttachedToPage,
                                                 boolean ignorePageIsAncestor)
        INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
        Executes this script node if necessary and/or possible.
        Parameters:
        element - the element
        ignoreAttachedToPage - don't do the isAttachedToPage check
        ignorePageIsAncestor - don't do the element.getPage().isAncestorOf(element) check
      • isJavaScript

        public static boolean isJavaScript​(DomElement element,
                                           java.lang.String typeAttribute,
                                           java.lang.String languageAttribute)
        Returns true if a script with the specified type and language attributes is actually JavaScript. According to W3C recommendation are content types case insensitive.
        IE supports only a limited number of values for the type attribute. For testing you can use http://www.robinlionheart.com/stds/html4/scripts.
        Parameters:
        element - the element
        typeAttribute - the type attribute specified in the script tag
        languageAttribute - the language attribute specified in the script tag
        Returns:
        true if the script is JavaScript