Skip to content

Commit

Permalink
fix `Tag inside a Table with on-click function is not working properl…
Browse files Browse the repository at this point in the history
…y in IE Browser` (close DevExpress#1908) (DevExpress#1927)
  • Loading branch information
LavrovArtem authored and AndreyBelym committed Feb 28, 2019
1 parent 8a120be commit 3e659ca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
16 changes: 4 additions & 12 deletions src/client/sandbox/node/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,19 +385,11 @@ export default class WindowSandbox extends SandboxBase {
};
}

window.open = function () {
const newArgs = [];
const target = arguments[1] ? nodeSandbox.element.getTarget(null, arguments[1]) : '_self';
window.open = function (...args) {
args[0] = getProxyUrl(args[0]);
args[1] = args[1] ? nodeSandbox.element.getTarget(null, String(args[1])) : '_self';

newArgs.push(getProxyUrl(arguments[0]));
newArgs.push(target);

if (arguments.length > 2)
newArgs.push(arguments[2]);
if (arguments.length > 3)
newArgs.push(arguments[3]);

return nativeMethods.windowOpen.apply(window, newArgs);
return nativeMethods.windowOpen.apply(window, args);
};

if (window.FontFace) {
Expand Down
10 changes: 9 additions & 1 deletion test/client/fixtures/target-attr-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ test('change window name', function () {
test('window.open', function () {
var nativeWindowOpen = nativeMethods.windowOpen;
var targets = [];
var iframe = document.createElement('iframe');

iframe.setAttribute('id', 'test' + Date.now());
iframe.setAttribute('name', '2');
document.body.appendChild(iframe);

nativeMethods.windowOpen = function (url, target) {
targets.push(target);
Expand All @@ -114,15 +119,18 @@ test('window.open', function () {
window.open('http://some-url.com/', 'window_name');
window.open('http://some-url.com/', 'unknow_name');
window.open('http://some-url.com/');
window.open('http://some-url.com/', 2);

strictEqual(targets.length, 5);
strictEqual(targets.length, 6);
strictEqual(targets[0], '_self');
strictEqual(targets[1], '_top');
strictEqual(targets[2], 'window_name');
strictEqual(targets[3], '_top');
strictEqual(targets[4], '_self');
strictEqual(targets[5], '2');

nativeMethods.windowOpen = nativeWindowOpen;
document.body.removeChild(iframe);
});

test('case insensitive target="_blank"', function () {
Expand Down

0 comments on commit 3e659ca

Please sign in to comment.