New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/net/html: invalid parsing of html fragment with self-closing iframe #22298
Comments
I think this is actually correct. <iframe> is not a self-closing tag. If I copy your original input into https://validator.w3.org/#validate_by_input, nested into
Wading through the HTML spec, I see: https://html.spec.whatwg.org/#acknowledge-self-closing-flag
https://html.spec.whatwg.org/#parse-error-non-void-html-element-start-tag-with-trailing-solidus
The parser should treat everything after
That is, everything after the
The only difference is that Chrome escapes the text inside the |
I don't think this is a bug. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go 1.9.1
Does this issue reproduce with the latest release?
Yes, including the up-to-date x/net/html dependency
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/urandom/.go"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build316910682=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
play link:
https://play.golang.org/p/DViZItBoV5
The above example illustrates the problem. There is one self-closing iframe within the snippet. After parsing and then subsequent rendering, the self-closing tag is replaced by an open one, and a closing tag is placed in an incorrect place. In the above example, the following output is produced:
The text was updated successfully, but these errors were encountered: