| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Review requested:
|
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM!
Sorry, something went wrong.
| node.children.unshift({ | ||
| type: 'html', | ||
| value: `<div class="api_stability api_stability_${number}">` + | ||
| value: `<div class="api_stability api_stability_${parseInt(number)}">` + |
There was a problem hiding this comment.
parseInt will only grab the numeric pieces of "number" right?
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, in the regex that the part for number is /\d(?:\.\d)? meaning that the number matched value can be a single digit optionally followed by a dot followed by another digit, parseInt run on such numbers/strings always returns the integer part of the number:

And that's the part we need based on the css classes we have:
Lines 324 to 338 in d7becc5
Sorry, something went wrong.
There was a problem hiding this comment.
I used the same trick in the web generator :-)
Sorry, something went wrong.
There was a problem hiding this comment.
I just wanted to confirm. I recall either parseInt or Number() parse the numeric parseable stuff until it finds something non-numeric.
Sorry, something went wrong.
There was a problem hiding this comment.
No, not until it finds something non-numeric. It parses the float since it's a valid number, and flattens it to an integer.
Sorry, something went wrong.
|
Note to web infra teams: this doesn't need to be ported to api-docs-tooling, I (independently from this) changed the logic to something similar in the web generator PR. |
Sorry, something went wrong.
Thanks, I was about to ask someone at some point if this needed porting (as I haven't looked too much into the new tooling I must admit 😓) but you saved me the effort 🫶 |
Sorry, something went wrong.
|
I wish I could have landed this haha; Ah how it sucks not being a collaborator anymore lol |
Sorry, something went wrong.
PR-URL: #58783 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: #58783 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: #58783 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
| Back | FazBrowse Home | New Git URL |
Pretty minor, this is just addressing a minimal UI quirk I noticed with the Stability 1.x links where the decimal digits are not included in the hyperlink
PS: I've also moved the regex outside of the preprocessElements function, as there is no reason/benefit to have the regex rebuilt for every file (having it outside might save some precious nanoseconds when building the docs 😅).
Before
After