Closed JeremiahChurch closed 6 years ago
Hi @Tongboy, interesting, we didn't catch that. thank you for fixing it 👍
oh nooo. why am I so bad at regexp?! shit... thanks @Tongboy for debugging and fixing this.
we should add a spec for this, can you add that? also we should probably change the regexp for the head tag also?
I'll take a look at adding a spec.
Not sure of the value of changing the head regex to match. Only non displayed elements are in the head so the only reason to do that would to ensure the js is inserted in a deterministic location (always before everything else, not sure that would cause any problems?) Right now it will be towards the bottom of the head tag and the exact location will change based on HTML tag elements.
The only sure benefit I could see to match the head behavior would be a potential speed increase. the regex match pattern would always be much shorter...
@Tongboy please bundle the new release 1.6.0
:)
@DonSchado we should also do a patch release with this one
ah, 1.5.1 you mean, yeah good idea
Change introduced in #86 causes issues with mismatches of closing brackets (single elements vs separately closed elements
<input/>
vs<div></div>
) - removing the greediness cleanly matches just the<body>
tag - regardless of what's contained in it.You can see the problem with this behavior in rubular
<body.*>
vs<body.*?>
- use the below HTML - the first without the question mark will return most (but not all!) of the HTML - with the question mark just the body tag is returned in the match.sample HTML code used to repro issue:
Our users reported the issue when some (but not all, based on luck of the HTML) of our textarea elements would end up with the google tag manager code in addition to whatever would normally be there. any other mismatching html tags and the code would just have been in a random div on the page - no problem.