Skip to content

Commit 698c368

Browse files
committed
Fix scope issue on replacing the element after page load
1 parent 9e7916c commit 698c368

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

dist/jpack.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

es/navigation/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@ export const navigation = {
337337
*/
338338
replacePageContent(html, url, incoming_el, replace_el, push_state)
339339
{
340+
var self = this;
341+
340342
push_state = typeof push_state === 'undefined' ? true : push_state;
341343

342344
incoming_el = typeof incoming_el === 'undefined' || !incoming_el ? this.getIncomingElement() : incoming_el;
@@ -386,8 +388,8 @@ export const navigation = {
386388

387389
//if the replace_el is the same as getReplaceElement(),
388390
// then it should be updated to whatever the incoming_el is because it no longer exists
389-
if( this.getReplaceElement() === replace_el ){
390-
this.setReplaceElement(incoming_el);
391+
if( self.getReplaceElement() !== replace_el ){
392+
self.setReplaceElement(incoming_el);
391393
}
392394
}
393395
}, 100);

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@htmlguyllc/jpack",
3-
"version": "4.1.16",
3+
"version": "4.1.17",
44
"description": "Core Javascript Library of Everyday Objects, Events, and Utilities",
55
"keywords": [
66
"javascript",

src/jpack.compiled.js

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)