benschwarz / developers.whatwg.org

Used to create the contents of developers.whatwg.org
http://developers.whatwg.org/
198 stars 39 forks source link

Make link fixup script faster #23

Closed zcorpan closed 7 years ago

zcorpan commented 13 years ago
zcorpan Hixie: could you run the fixBrokenLink() script earlier than onload to speed up loading?
10:48   zcorpan benschwarz: same with you ^ 
    benschwarz      zcorpan: other than the obvious factor of it "fixing the links"
    benschwarz  what does it actually do?
    zcorpan benschwarz: it redirects to the right page if the fragment is not found on the current page
10:52   benschwarz      zcorpan: so its important for the pages that are split?
    benschwarz  (multipage specs)?
    zcorpan yeah
10:53   zcorpan but hmm, i guess it needs to be run after the content has been loaded after all
    zcorpan so ignore me
    benschwarz      zcorpan: perhaps I could re-write it in ruby postprocessors
    benschwarz  and remove the script altogether
10:55   zcorpan benschwarz: that wouldn't work, it needs to be in javascript
10:57   zcorpan but link-fixup.js logic could be put in fragment-links.js and instead of checking getElementById() just check if the current fragment is in the table and if so, if the current page matches what the table says it should be
10:58   zcorpan then you could run it ASAP and get faster redirects
    benschwarz      zcorpan: I'll look into it

This can't be done server-side because the server doesn't see the fragments.

With the current setup, http://www.whatwg.org/specs/web-apps/current-work/multipage/link-fixup.js should actually be run instead of directly running fragment-links.js since the latter will try to redirect even if you're on the right page.

domenic commented 7 years ago

I think this is fixed, or at least it's just as fast on the revamped developer's edition as it is on the main HTML spec, so any issues can be filed against that. So, let me close this.