Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 047db48

Browse files
author
Gabriel Schulhof
committed
Pagecontainer: Remove extra decoding step, now part of _createDataUrl()
This also removes the possibility that a URL gets double-decoded.
1 parent 27fbd5b commit 047db48

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

js/widgets/pagecontainer.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -351,24 +351,23 @@ define( [
351351
// TODO consider supporting a custom callback
352352
var fileUrl = this._createFileUrl( absUrl ),
353353
dataUrl = this._createDataUrl( absUrl ),
354-
decodedDataUrl = this.window[ 0 ].decodeURIComponent( dataUrl ),
355354
page, initialContent = this._getInitialContent();
356355

357356
// Check to see if the page already exists in the DOM.
358357
// NOTE do _not_ use the :jqmData pseudo selector because parenthesis
359358
// are a valid url char and it breaks on the first occurence
360359
page = this.element
361360
.children( "[data-" + this._getNs() +
362-
"url='" + $.mobile.path.hashToSelector( decodedDataUrl ) + "']" );
361+
"url='" + $.mobile.path.hashToSelector( dataUrl ) + "']" );
363362

364363
// If we failed to find the page, check to see if the url is a
365364
// reference to an embedded page. If so, it may have been dynamically
366365
// injected by a developer, in which case it would be lacking a
367366
// data-url attribute and in need of enhancement.
368367
if ( page.length === 0 && dataUrl && !$.mobile.path.isPath( dataUrl ) ) {
369368
page = this.element.children( $.mobile.path.hashToSelector("#" + dataUrl) )
370-
.attr( "data-" + this._getNs() + "url", decodedDataUrl )
371-
.jqmData( "url", decodedDataUrl );
369+
.attr( "data-" + this._getNs() + "url", dataUrl )
370+
.jqmData( "url", dataUrl );
372371
}
373372

374373
// If we failed to find a page in the DOM, check the URL to see if it
@@ -444,9 +443,7 @@ define( [
444443
// TODO tagging a page with external to make sure that embedded pages aren't
445444
// removed by the various page handling code is bad. Having page handling code
446445
// in many places is bad. Solutions post 1.0
447-
page.attr( "data-" + this._getNs() + "url",
448-
this.window[ 0 ].decodeURIComponent(
449-
this._createDataUrl( fileUrl ) ) )
446+
page.attr( "data-" + this._getNs() + "url", this._createDataUrl( fileUrl ) )
450447
.attr( "data-" + this._getNs() + "external-page", true );
451448

452449
return page;

0 commit comments

Comments
 (0)