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 * Sets if executed.
39 * @param executed if executed
40 */
41 void setExecuted(boolean executed);
42
43 /**
44 * Returns the script source url.
45 *
46 * @return the script source url
47 */
48 String getScriptSource();
49
50 /**
51 * Returns the charset used for the script encoding.
52 *
53 * @return the charset used for the script encoding
54 */
55 String getScriptCharset();
56
57 /**
58 * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br>
59 *
60 * Marks this script as created by javascript.
61 * Spec: The following scripts will not execute: scripts in XMLHttpRequest's responseXML documents,
62 * scripts in DOMParser-created documents, scripts in documents created by XSLTProcessor's
63 * transformToDocument feature, and scripts that are first inserted by a script into a Document
64 * that was created using the createDocument() API
65 */
66 void markAsCreatedByDomParser();
67
68 /**
69 * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br>
70 *
71 * Returns true if this frame was created by javascript.
72 * @return true or false
73 */
74 boolean wasCreatedByDomParser();
75 }