bryanmcquade / scroll-to-css-selector

Explainer for supporting CSS selectors when navigating to a URL fragment
61 stars 1 forks source link

What does targetElement=.foo&bar match? #6

Open jakearchibald opened 6 years ago

jakearchibald commented 6 years ago

targetElement=.foo&bar

Does the selector parsing end at &? It feels like it should if you're going with a urlencoded style.

tigt commented 6 years ago

If I understand correctly, if one wants an ampersand selector inside targetElement, it should be URL-encoded as %26.

Otherwise, Jake’s interpretation would override the selector.

BigBlueHat commented 6 years ago

This is where the parenthetical style would really clarify things. Hard to misread this variation: #targetElement(.foo&bar). Additionally, it opens the door back up for sites to use hash fragments in a query parameter style: #targetElement(.foo&bar)&pid=5 (where pid is a site specific page id or something).