From e1865ca00d20492ba1f75a6ced384a8dae245802 Mon Sep 17 00:00:00 2001 From: Rodney Rehm Date: Wed, 9 Apr 2014 18:37:35 +0200 Subject: [PATCH] fixing cross origin resource problem with CSSOM - closes #6 --- viewport-units-buggyfill.js | 74 +++++++++++++++++++++++++++++++++---- 1 file changed, 67 insertions(+), 7 deletions(-) diff --git a/viewport-units-buggyfill.js b/viewport-units-buggyfill.js index 38e0328..905d098 100644 --- a/viewport-units-buggyfill.js +++ b/viewport-units-buggyfill.js @@ -19,7 +19,7 @@ } }(this, function () { 'use strict'; - /*global document, window*/ + /*global document, window, location, XMLHttpRequest, XDomainRequest*/ var initialized = false; var viewportUnitExpression = /([0-9.-]+)(vh|vw|vmin|vmax)/g; @@ -39,12 +39,16 @@ styleNode = document.createElement('style'); styleNode.id = 'patched-viewport'; document.head.appendChild(styleNode); - - //window.addEventListener('orientationchange', updateStyles, true); - // doing a full refresh rather than updateStyles because an orientationchange - // could activate different stylesheets - window.addEventListener('orientationchange', refresh, true); - refresh(); + + // Issue #6: Cross Origin Stylesheets are not accessible through CSSOM, + // therefore download and inject them as