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
...will return ' ' if called with a string like class="foo" href="/blah", rather than '/blah'. If the attributes are reversed, it works correctly.
Changing each regex like so, so that the match indices are correct, seems to fix it:
-const match = /([\s'"]|^)href\s*=\s*(?:"(.*?)"|'(.*?)'|([^\s>]*))/.exec(attrs);+const match = /(?:[\s'"]|^)href\s*=\s*(?:"(.*?)"|'(.*?)'|([^\s>]*))/.exec(attrs);
Reproduction
If I get a chance to do this later I will... (under the cosh right now)
A thought that may or may not have merit: Have you considered parsing these values out instead of using regexes (I feel tempted to write regices because vertex -> vertices).
Parsing rendered HTML seems the most straight forward. But just how much this affects perf as page-count increases, I don't know.
I don't know whether it's at all possible, or worth the implementation effort to surface these values somehow in Svelte's parsing/render mechanism. If it were somehow possible, I assume said mechanism might eventually prove itself useful for other usecases/tooling beyond just getting hrefs.
Describe the bug
The prerenderer uses these regexes for crawling pages:
kit/packages/kit/src/core/adapt/prerender.js
Lines 17 to 46 in deabbd6
But this code...
...will return
' '
if called with a string likeclass="foo" href="/blah"
, rather than'/blah'
. If the attributes are reversed, it works correctly.Changing each regex like so, so that the match indices are correct, seems to fix it:
Reproduction
If I get a chance to do this later I will... (under the cosh right now)
Logs
No response
System Info
Severity
annoyance
Additional Information
I think we need to add a new option for the 'severity' dropdown — this isn't blocking, but it's more than an annoyance, it's a serious bug
The text was updated successfully, but these errors were encountered: