Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit fb46688

Browse files
committed
fix: preserve setters when wrapping XMLHttpRequest
change suggested by @tbosch (thx!) Closes #17
1 parent d1a2c8e commit fb46688

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Diff for: test/zone.spec.js

+8
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,14 @@ describe('Zone.patch', function () {
441441
expect(hasParent).toBe(true);
442442
});
443443
});
444+
445+
it('should preserve other setters', function () {
446+
var req = new XMLHttpRequest();
447+
req.open('get', '/', true);
448+
req.send();
449+
req.responseType = 'document';
450+
expect(req.responseType).toBe('document');
451+
});
444452
});
445453

446454

Diff for: zone.js

+2
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ Zone.patchClass = function (className) {
346346
set: function (fn) {
347347
if (typeof fn === 'function') {
348348
this._o[prop] = zone.bind(fn);
349+
} else {
350+
this._o[prop] = fn;
349351
}
350352
},
351353
get: function () {

0 commit comments

Comments
 (0)