Skip to content

Commit

Permalink
fix IE11 failing in TestCafe (closes #7741) (#2900)
Browse files Browse the repository at this point in the history
* fix IE11 failing in TestCafe (closes #7741)

* fix types

* keep functions in prototype

* remove note
  • Loading branch information
AlexKamaev authored May 31, 2023
1 parent a67ae07 commit 82cb4b6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "testcafe-hammerhead",
"description": "A powerful web-proxy used as a core for the TestCafe testing framework (https://github.com/DevExpress/testcafe).",
"version": "31.4.2",
"version": "31.4.3",
"homepage": "https://github.com/DevExpress/testcafe-hammerhead",
"bugs": {
"url": "https://github.com/DevExpress/testcafe-hammerhead/issues"
Expand Down
21 changes: 18 additions & 3 deletions src/processing/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,26 @@ import INTERNAL_ATTRS from '../processing/dom/internal-attributes';
import { isSpecialPage } from '../utils/url';
import { URL_ATTR_TAGS } from './dom/attributes';
import DomProcessor from './dom';
import { Dictionary } from '../typings/common';

const arrayJoin = Array.prototype.join;
const objectKeys = Object.keys;

function getTagsString (tagsDict: Dictionary<string[]>) {
const tags: string[] = [];

for (const key in tagsDict) {
for (const tag of tagsDict[key])
tags.push(tag);
}

return arrayJoin.call(tags).replace(/,/g, '|');
}

const SOURCE_MAP_RE = /\/\*\s*[#@]\s*sourceMappingURL\s*=[\s\S]*?\*\/|\/\/[\t ]*[#@][\t ]*sourceMappingURL[\t ]*=.*/ig;
const CSS_URL_PROPERTY_VALUE_RE = /(url\s*\(\s*(['"]?))([^\s]*?)(\2\s*\))|(@import\s+(['"]))([^\s]*?)(\6)/g;
const TAGS_STRING = Object.values(URL_ATTR_TAGS).join().replace(/,/g, '|');
const ATTRS_STRING = Object.keys(URL_ATTR_TAGS).join('|');
const TAGS_STRING = getTagsString(URL_ATTR_TAGS);
const ATTRS_STRING = arrayJoin.call(objectKeys(URL_ATTR_TAGS), '|');
const ATTRIBUTE_SELECTOR_RE = new RegExp(`(([#.])?(?:${TAGS_STRING})\\[\\s*)(${ATTRS_STRING})(\\s*(?:\\^)?=)`, 'g');
const STYLESHEET_PROCESSING_START_COMMENT = '/*hammerhead|stylesheet|start*/';
const STYLESHEET_PROCESSING_END_COMMENT = '/*hammerhead|stylesheet|end*/';
Expand Down Expand Up @@ -96,7 +111,7 @@ class StyleProcessor {
}


return parts.join('');
return arrayJoin.call(parts, '');
}

private _replaceStylesheetUrls (css: string, processor: Function): string {
Expand Down

0 comments on commit 82cb4b6

Please sign in to comment.