Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for isJSType (0.22 sec)

  1. src/html/template/js_test.go

    		{"text/javascript", true},
    		{"application/json", true},
    		{"application/ld+json", true},
    		{"module", true},
    	}
    
    	for _, test := range tests {
    		if isJSType(test.in) != test.out {
    			t.Errorf("isJSType(%q) = %v, want %v", test.in, !test.out, test.out)
    		}
    	}
    }
    
    func BenchmarkJSValEscaperWithNum(b *testing.B) {
    	for i := 0; i < b.N; i++ {
    		jsValEscaper(3.141592654)
    	}
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Feb 27 02:20:11 UTC 2024
    - 12.6K bytes
    - Viewed (0)
  2. src/html/template/js.go

    	case r == '_':
    		return true
    	case 'a' <= r && r <= 'z':
    		return true
    	}
    	return false
    }
    
    // isJSType reports whether the given MIME type should be considered JavaScript.
    //
    // It is used to determine whether a script tag with a type attribute is a javascript container.
    func isJSType(mimeType string) bool {
    	// per
    	//   https://www.w3.org/TR/html5/scripting-1.html#attr-script-type
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 26 19:58:28 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  3. src/html/template/escape.go

    	}
    
    	element := c.element
    
    	// If this is a non-JS "type" attribute inside "script" tag, do not treat the contents as JS.
    	if c.state == stateAttr && c.element == elementScript && c.attr == attrScriptType && !isJSType(string(s[:i])) {
    		element = elementNone
    	}
    
    	if c.delim != delimSpaceOrTagEnd {
    		// Consume any quote.
    		i++
    	}
    	// On exiting an attribute, we discard all state information
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 02 15:18:39 UTC 2023
    - 32.4K bytes
    - Viewed (0)
Back to top