Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/zone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,6 @@ const Zone: ZoneType = (function(global: any) {
type: this.type,
state: this.state,
source: this.source,
data: this.data,
zone: this.zone.name,
invoke: this.invoke,
scheduleFn: this.scheduleFn,
Expand Down
26 changes: 26 additions & 0 deletions test/browser/browser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,32 @@ describe('Zone', function() {
});
});
});

it('should be able to covert element with event listener to json without cyclic error',
function() {
const eventListenerSpy = jasmine.createSpy('eventListener');
let elemThrowErrorWhenToJson = false;
try {
JSON.stringify(button);
} catch (err) {
elemThrowErrorWhenToJson = true;
}

// in chrome mobile, dom element will throw
// cyclic error when call JSON.stringify,
// so we just ignore it.
if (elemThrowErrorWhenToJson) {
return;
}

Zone.current.run(function() {
button.addEventListener('click', eventListenerSpy);
});

expect(function() {
JSON.stringify(button);
}).not.toThrow();
});
});
});
});