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

Commit c09cde5

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 df8def5 commit c09cde5

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
@@ -356,24 +356,23 @@ define( [
356356
// TODO consider supporting a custom callback
357357
var fileUrl = this._createFileUrl( absUrl ),
358358
dataUrl = this._createDataUrl( absUrl ),
359-
decodedDataUrl = this.window[ 0 ].decodeURIComponent( dataUrl ),
360359
page, initialContent = this._getInitialContent();
361360

362361
// Check to see if the page already exists in the DOM.
363362
// NOTE do _not_ use the :jqmData pseudo selector because parenthesis
364363
// are a valid url char and it breaks on the first occurence
365364
page = this.element
366365
.children( "[data-" + this._getNs() +
367-
"url='" + $.mobile.path.hashToSelector( decodedDataUrl ) + "']" );
366+
"url='" + $.mobile.path.hashToSelector( dataUrl ) + "']" );
368367

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

379378
// If we failed to find a page in the DOM, check the URL to see if it
@@ -449,9 +448,7 @@ define( [
449448
// TODO tagging a page with external to make sure that embedded pages aren't
450449
// removed by the various page handling code is bad. Having page handling code
451450
// in many places is bad. Solutions post 1.0
452-
page.attr( "data-" + this._getNs() + "url",
453-
this.window[ 0 ].decodeURIComponent(
454-
this._createDataUrl( fileUrl ) ) )
451+
page.attr( "data-" + this._getNs() + "url", this._createDataUrl( fileUrl ) )
455452
.attr( "data-" + this._getNs() + "external-page", true );
456453

457454
return page;

0 commit comments

Comments
 (0)