Skip to content

Fix double quotes inside attribute values

jpic ∞ requested to merge jpic into master

Previously we were stripping double quotes and this Python::

onclick='document.querySelector("foo")'

Became this HTML::

onclick="document.querySelector(foo)"

This commit fixes that behaviour by escaping double quotes properly inside attribute values, unless they are already escaped, which is why the negative lookbehind is used in the regexp.

Merge request reports