View Javadoc
1   /*
2    * Copyright (c) 2002-2026 Gargoyle Software Inc.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * https://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  package org.htmlunit.html;
16  
17  /**
18   * An element which can handle scripts.
19   *
20   * @author Ahmed Ashour
21   * @author Ronald Brill
22   */
23  public interface ScriptElement {
24  
25      /**
26       * Returns if executed.
27       * @return if executed
28       */
29      boolean isExecuted();
30  
31      /**
32       * Returns {@code true} if this script is deferred.
33       * @return {@code true} if this script is deferred
34       */
35      boolean isDeferred();
36  
37      /**
38       * Returns {@code true} if this crossorigin attribute is available.
39       * @return {@code true} if this crossorigin attribute is available.
40       */
41      boolean isCrossorigin();
42  
43      /**
44       * Sets if executed.
45       * @param executed if executed
46       */
47      void setExecuted(boolean executed);
48  
49      /**
50       * Returns the script source url.
51       *
52       * @return the script source url
53       */
54      String getScriptSource();
55  
56      /**
57       * Returns the charset used for the script encoding.
58       *
59       * @return the charset used for the script encoding
60       */
61      String getScriptCharset();
62  
63      /**
64       * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br>
65       *
66       * Marks this script as created by javascript.
67       * Spec: The following scripts will not execute: scripts in XMLHttpRequest's responseXML documents,
68       * scripts in DOMParser-created documents, scripts in documents created by XSLTProcessor's
69       * transformToDocument feature, and scripts that are first inserted by a script into a Document
70       * that was created using the createDocument() API
71       */
72      void markAsCreatedByDomParser();
73  
74      /**
75       * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br>
76       *
77       * Returns true if this frame was created by javascript.
78       * @return true or false
79       */
80      boolean wasCreatedByDomParser();
81  }