Skip to content

Commit

Permalink
Do not issue request for undefined hrefs
Browse files Browse the repository at this point in the history
  • Loading branch information
alshakero committed Nov 27, 2017
1 parent 06976df commit 7fbd1f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions juicy-html.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
},
'href': {
set: function(newValue) {
if(newValue === null){
if(newValue === null || newValue === undefined){
this.removeAttribute('href');
} else {
this.setAttribute('href', newValue);
Expand All @@ -67,7 +67,7 @@
},
'html': {
set: function(newValue) {
if(newValue === null){
if(newValue === null || newValue === undefined){
this.removeAttribute('html');
} else {
this.setAttribute('html', newValue);
Expand Down
8 changes: 8 additions & 0 deletions test/skipping.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@
expect(myEl.skipStampingPendingFile).not.to.be.called;
});
});
describe("Undefined URL", function() {
it("It shouldn't issue a request if URL is undefined", function() {
myEl = fixture('juicy-html-fixture').querySelector('template[is="juicy-html"]');
sinon.spy(myEl, '_loadExternalFile');
myEl.href = undefined;
expect(myEl._loadExternalFile).not.to.be.called;
});
});
});
</script>

Expand Down

0 comments on commit 7fbd1f5

Please sign in to comment.