MCPcopy
hub / github.com/BishopFox/jsluice / isProbablyHTML

Function isProbablyHTML

analyzer.go:70–83  ·  view source on GitHub ↗

isProbablyHTML returns true for source that is probably HTML. False positives are OK as long as the false positives are not JavaScript source.

(source []byte)

Source from the content-addressed store, hash-verified

68// False positives are OK as long as the false positives are not
69// JavaScript source.
70func isProbablyHTML(source []byte) bool {
71 for _, b := range source {
72 if unicode.IsSpace(rune(b)) {
73 continue
74 }
75
76 if b == '<' {
77 return true
78 }
79 break
80 }
81
82 return false
83}
84
85// extractInlineJS extracts inline JavaScript from HTML pages using goquery.
86func extractInlineJS(source []byte) []byte {

Callers 2

TestIsProbablyHTMLFunction · 0.85
NewAnalyzerFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestIsProbablyHTMLFunction · 0.68