wet-boew / wet-boew-drupal

Drupal variant of the Web Experience Toolkit (WET)
137 stars 74 forks source link

Conditional JS Includes Not Working Properly #1771

Closed kristremblay closed 8 years ago

kristremblay commented 8 years ago

We are continuously getting javascript exceptions "Cannot read property 'appendChild' of null" from ie8-wet-boew-min,js and after fantasizing about banging my head off the desk, I've found that in the generated source isn't quite right.

By looking at http://canada.gc.ca source, you can see that file is supposed to be inside a condition (I mean...looking at the name alone tells you that, but it;s besides the point). If I open _wetkitwetboew.libraries.inc I can see that this is the intended result:

 'js/ie8-wet-boew.min.js' => array(
                  'browsers' => array(
                    'IE' => 'lt IE 9',
                    '!IE' => FALSE,
                  ),
                  'every_page' => TRUE,
                  'preprocess' => FALSE,
                  'scope' => 'header',
                  'weight' => 6,
                ),
                'js/ie8-wet-boew2.min.js' => array(
                  'browsers' => array(
                    'IE' => 'lt IE 9',
                    '!IE' => FALSE,
                  ),
                  'every_page' => TRUE,
                  'preprocess' => TRUE,
                  'scope' => 'footer',
                  'weight' => 6,
                ),

I have tried commenting out the entire block, and as expected the scripts are no longer included. However, if I change the IE value it is not reflected in the source.

Am I missing something obvious?

kristremblay commented 8 years ago

Just an update, this does not happen on all installations. I have been working on a local installation on my macbook for the past week without developing the issue. However, it has appeared in several installations on a couple different servers include a local VM. Each installation has been done identically, but oddly at least one installations is still working as intended.

sylus commented 8 years ago

I have tried to reproduce this myself to no avail, even took a look at a few environments and none of them were exhibiting this behavior. I might need more information to provide assistance.

It might be a browser issue on your end? Perhaps one of your browsers (IE) is using compatability mode that ignores the conditional?

If possible please give exact reproduction steps (no step being too small to list). As well please provide the version of Drupal WxT (4.1 or dev date) and the browser + version your testing on.

If possible please file an issue on drupal.org/project/wetkit as that is our main queue that I check much more frequently. Hope that helps :)

kristremblay commented 8 years ago

Will do, and I appreciate your time :)

I have not been using a compatibility mode in any of my browsers and it did show up in the most recent versions of Firefox, Chrome, and Edge.

That being said, I have been unable to reproduce the issue since posting this, which leads me to believe there's a ghost in the machine lol. I will be Trying to break it again today, if I come up with anything I'll post.

Have a great day.