You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.
// If we failed to find the page, check to see if the url is a// reference to an embedded page. If so, it may have been dynamically// injected by a developer, in which case it would be lacking a data-url// attribute and in need of enhancement.if(page.length===0&&dataUrl&&!path.isPath(dataUrl)){page=settings.pageContainer.children("#"+dataUrl).attr("data-"+$.mobile.ns+"url",dataUrl).jqmData("url",dataUrl);}
Instead of .children( "#" + dataUrl ) we need to use document.getElementById(), because that function can handle the weird characters that may be present in the ID, but then we still need to make sure that the returned element is a child of settings.pageContainer.
The workaround we should advocate for now is for devs to always add the data-url attribute to their dynamically created pages. They need not worry about adding the data-url attribute to static pages, because that's added by us upon init.
I didn't want to make the change because of @johnbender's nav refactor work. It would make merging harder afterwards.
The text was updated successfully, but these errors were encountered:
I decided instead to centralize the implementation of the conversion of hash to selector (thereby making a minor modification to js/jquery.mobile.navigation.js), for two reasons:
It makes no sense to place escaped hashes into the DOM as the custom select widget was doing before. The hashes need to appear unescaped in the DOM, and they should be escaped at the point where they are passed to the jQuery constructor.
Using getElementById() doesn't make sense in places other than init, because in all other places where a hash that contains special characters presents a problem, we are using selectors not wrt. the document, but wrt. a given element (settings.pageContainer for dialogs and the current page for popups). document.getElementById() cannot be limited to a subtree (unlike jQuery objects), so it's better to create a valid jQuery selector.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Context: js/jquery.mobile.navigation.js:
Instead of
.children( "#" + dataUrl )
we need to usedocument.getElementById()
, because that function can handle the weird characters that may be present in the ID, but then we still need to make sure that the returned element is a child ofsettings.pageContainer
.The workaround we should advocate for now is for devs to always add the
data-url
attribute to their dynamically created pages. They need not worry about adding thedata-url
attribute to static pages, because that's added by us upon init.I didn't want to make the change because of @johnbender's nav refactor work. It would make merging harder afterwards.
The text was updated successfully, but these errors were encountered: