bv-ui-core 2.9.9 → 2.9.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,6 @@ var waitForBody = require('../waitForBody');
11
11
  var constructors = {};
12
12
  // eslint-disable-next-line no-useless-escape
13
13
  var constructorNameRegExp = /function\s+([^\(\s]+)/;
14
- var iframe;
15
14
 
16
15
  var getOriginalConstructor = function getOriginalConstructor (constructor) {
17
16
  return new Promise(function (resolve) {
@@ -24,25 +23,30 @@ var getOriginalConstructor = function getOriginalConstructor (constructor) {
24
23
  constructorName = constructorNameRegExp.exec(constructor.toString())[1];
25
24
  }
26
25
 
27
- if (!iframe) {
28
- iframe = document.createElement('iframe');
29
- iframe.src = 'about:blank';
30
- iframe.style.display = 'none';
31
- iframe.height = '0';
32
- iframe.width = '0';
33
- iframe.tabIndex = '-1';
34
- iframe.title = 'empty';
35
- iframe.className = 'hidden';
36
- document.body.appendChild(iframe);
26
+ if (constructors[constructorName]) {
27
+ resolve(constructors[constructorName]);
28
+ return;
37
29
  }
38
-
39
- if (!constructors[constructorName]) {
40
- constructors[constructorName] = iframe.contentWindow[constructorName];
41
- }
42
-
30
+ const tempIframe = document.createElement('iframe');
31
+ tempIframe.src = 'about:blank';
32
+ tempIframe.style.display = 'none';
33
+ tempIframe.style.position = 'absolute';
34
+ tempIframe.style.left = '-9999px';
35
+ tempIframe.height = '0';
36
+ tempIframe.width = '0';
37
+ tempIframe.tabIndex = '-1';
38
+ tempIframe.title = '';
39
+ tempIframe.setAttribute('aria-hidden', 'true');
40
+ tempIframe.setAttribute('role', 'presentation');
41
+
42
+ document.body.appendChild(tempIframe);
43
+
44
+ constructors[constructorName] = tempIframe.contentWindow[constructorName];
45
+ document.body.removeChild(tempIframe);
46
+
43
47
  resolve(constructors[constructorName]);
44
48
  });
45
49
  });
46
50
  };
47
51
 
48
- module.exports = getOriginalConstructor;
52
+ module.exports = getOriginalConstructor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bv-ui-core",
3
- "version": "2.9.9",
3
+ "version": "2.9.10",
4
4
  "license": "Apache 2.0",
5
5
  "description": "Bazaarvoice UI-related JavaScript",
6
6
  "repository": {