MCPcopy Index your code
hub / github.com/HtmlUnit/htmlunit / getScriptableObject

Method getScriptableObject

src/main/java/org/htmlunit/html/DomNode.java:889–913  ·  view source on GitHub ↗

INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK. Returns the JavaScript object that corresponds to this node, lazily initializing a new one if necessary. The logic of when and where the JavaScript object is created needs a cleanup: f

()

Source from the content-addressed store, hash-verified

887 * @return the JavaScript object that corresponds to this node
888 */
889 @SuppressWarnings("unchecked")
890 public <T extends HtmlUnitScriptable> T getScriptableObject() {
891 if (scriptObject_ == null) {
892 final SgmlPage page = getPage();
893 if (this == page) {
894 final StringBuilder msg = new StringBuilder("No script object associated with the Page.");
895 // because this is a strange case we like to provide as much info as possible
896 msg.append(" class: '")
897 .append(page.getClass().getName())
898 .append('\'');
899 try {
900 msg.append(" url: '")
901 .append(page.getUrl()).append("' content: ")
902 .append(page.getWebResponse().getContentAsString());
903 }
904 catch (final Exception e) {
905 // ok bad luck with detail
906 msg.append(" no details: '").append(e).append('\'');
907 }
908 throw new IllegalStateException(msg.toString());
909 }
910 scriptObject_ = page.getScriptableObject().makeScriptableFor(this);
911 }
912 return (T) scriptObject_;
913 }
914
915 /**
916 * {@inheritDoc}

Callers 10

getScriptableForMethod · 0.95
getNamedItemNSMethod · 0.95
itemMethod · 0.95
querySelectorMethod · 0.95
importNodeMethod · 0.95
querySelectorMethod · 0.95
querySelectorMethod · 0.95
isIsContentEditableMethod · 0.95
fireEventMethod · 0.95

Calls 10

getPageMethod · 0.95
getUrlMethod · 0.95
getWebResponseMethod · 0.95
getNameMethod · 0.65
getScriptableObjectMethod · 0.65
appendMethod · 0.45
getClassMethod · 0.45
getContentAsStringMethod · 0.45
toStringMethod · 0.45
makeScriptableForMethod · 0.45

Tested by

no test coverage detected