Closed (fixed)
Project:
Google Tag
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Reporter:
Created:
4 Mar 2014 at 01:28 UTC
Updated:
18 Mar 2014 at 13:41 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mparker17Okay, actually, this only happens if the module is set to compact the output so I'm downgrading from Critical to Major.
Comment #2
mparker17Comment #3
mparker17It turns out the linebreak in the middle of the
iframetag in the noscript section was causing HTML that looked likens.html?id=GTM-00000"height="0"to be output, which should be fine but could in theory throw off some browsers.Since the goal of the "compact" option is to remove as much unnecessary whitespace as possible, but keep the HTML and JS valid, I figured it would be best to
preg_replaceall instances of 1 or more pieces of whitespace with a single space. In practice, this causes a bit more whitespace than strictly necessary, but it's better than causing Google Tag Manager to stop working in browsers with JS enabled :)If we really wanted to bikeshed, I couldn't find recent performance statistics for
preg_replaceversusstr_replacebut they were pretty close for simple replacements in early 2011.Comment #4
solotandem commentedThanks for noting this. Obviously, it was not the intention to remove all spaces, but a simple oversight. To fix this, I retained the simple string replacement instead of switching to a regular expression routine.
Fixed in this commit.