loadPage() can not correctly handle data-url with multiple parameters #3714

Closed
Azuo opened this Issue Mar 2, 2012 · 0 comments

Projects

None yet

3 participants

@Azuo

Per HTML specification, if a page is written in XHTML syntax, any "&" character must be escaped as "&" (a HTML5 page contains unescaped "&" characters won't pass W3C's validation service at all).

If a data-url attribute is expected to be explictily specified for a page, and the url contains multiple parameters, e.g.:

/foo?a=1&b=2

Then the markup should be:

<div data-role="page" data-url="/foo?a=1&amp;b=2"></div>

Currently loadPage() uses a regex to test against the HTML text to obtain the value of data-url, so it must unescape XML entities itself, otherwise, a wrong result must be returned.

Update the following line in $.mobile.loadPage():

url = fileUrl = path.getFilePath( RegExp.$1 );

to:

url = fileUrl = path.getFilePath( $("<div>" + RegExp.$1 + "</div>").text() );

will solve the problem.

@Azuo Azuo added a commit that referenced this issue Mar 7, 2012
@Azuo Azuo Fixes #3714 and #3726 f70717d
@gseguin gseguin was assigned Mar 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment