@@ -131,7 +131,9 @@ else if (postponed && !hasNoSrcAttrib) {
131131 else {
132132 try {
133133 action .execute ();
134- engine .processPostponedActions ();
134+ if (engine != null ) {
135+ engine .processPostponedActions ();
136+ }
135137 }
136138 catch (final RuntimeException e ) {
137139 throw e ;
@@ -212,7 +214,7 @@ else if (element.getFirstChild() != null) {
212214 final Document doc = win .getDocument ();
213215 try {
214216 doc .setCurrentScript (element .getScriptableObject ());
215- executeInlineScriptIfNeeded (script );
217+ executeInlineScript (script );
216218 }
217219 finally {
218220 doc .setCurrentScript (null );
@@ -315,18 +317,9 @@ private static void executeEvent(final DomElement element, final String type) {
315317 }
316318
317319 /**
318- * Executes this script node as inline script if necessary and/or possible .
320+ * Executes this script node as inline script.
319321 */
320- private static void executeInlineScriptIfNeeded (final ScriptElement script ) {
321- if (!isExecutionNeeded (script , false , false )) {
322- return ;
323- }
324-
325- final String src = script .getScriptSource ();
326- if (src != ATTRIBUTE_NOT_DEFINED ) {
327- return ;
328- }
329-
322+ private static void executeInlineScript (final ScriptElement script ) {
330323 final DomElement element = (DomElement ) script ;
331324 final String forr = element .getAttributeDirect ("for" );
332325 String event = element .getAttributeDirect ("event" );
@@ -354,14 +347,12 @@ private static void executeInlineScriptIfNeeded(final ScriptElement script) {
354347 * Gets the script held within the script tag.
355348 */
356349 private static String getScriptCode (final DomElement element ) {
357- final Iterable <DomNode > textNodes = element .getChildren ();
358350 final StringBuilder scriptCode = new StringBuilder ();
359- for (final DomNode node : textNodes ) {
351+ for (final DomNode node : element . getChildren () ) {
360352 if (node instanceof DomText domText ) {
361353 scriptCode .append (domText .getData ());
362354 }
363355 }
364356 return scriptCode .toString ();
365357 }
366-
367358}
0 commit comments