shithub: riscv

Download patch

ref: 2fd758bf2a32d49731d477af6aa18ef763e20937
parent: f57e4ecb015db6b1f7f4e1db1efa76dc9b1fadcc
author: cinap_lenrek <[email protected]>
date: Sun Sep 9 23:09:30 EDT 2012

mothra: simpler approach to ignoring <script> tags

--- a/sys/src/cmd/mothra/rdhtml.c
+++ b/sys/src/cmd/mothra/rdhtml.c
@@ -1007,28 +1007,6 @@
 		case Tag_isindex:
 			rdform(&g);
 			break;
-		case Tag_script:
-		case Tag_object:
-		case Tag_applet:
-		case Tag_style:
-			/*
-			 * ignore the content of these tags, eat tokens until we
-			 * reach a matching endtag.
-			 */
-			t = g.tag;
-			for(;;){
-				switch(pl_gettoken(&g)){
-				default:
-					continue;
-				case ENDTAG:
-					if(g.tag != t)
-						continue;
-				case EOF:
-					break;
-				}
-				break;
-			}
-			break;
 		}
 		break;
 
@@ -1101,6 +1079,13 @@
 		}
 		break;
 	case TEXT:
+		switch(g.state->tag){
+		case Tag_script:
+		case Tag_object:
+		case Tag_applet:
+		case Tag_style:
+			continue;
+		}
 		if(g.state->link[0]==0 && (str = linkify(g.token))){
 			nstrcpy(g.state->link, str, sizeof(g.state->link));
 			pl_htmloutput(&g, g.nsp, g.token, 0);