It does the same as before.
I think performance is not a concern here, and wasn't my motivation
either. But I hope this makes the code easier to read and to reason
with.
I added a pure unit test case (without involving an actual Language
object) to cover the previously uncovered digits feature.
Change-Id: I6a0fc86035817eabb42b55e58183ae094c052aa6
I was curious why running the CommentParserTest takes so long. I
found this is one of the bottlenecks because it's called so often,
but many link titles that are parsed as user names turn out to be
something else. This little hack speeds up the test by 15% and has
probably a similar impact in production scenarios.
Change-Id: I5a0b3a49ba5793c8a345baaa7118fed500c082b6
I was curious why running some of the PHPUnit tests in this code base
takes so long. While I could not spot an obvious bottleneck I found
a lot of code that is extremely hot, e.g. called a hundred thousand
times. A few obvious optimizations are possible in this code, e.g.
not calling the surprisingly expensive DOMCompat::getClassList
multiple times.
Change-Id: If22bbc1aedd2c36db1ab2343de5737009050b7bb
There is nothing in this preg_replace call that needs to be executed
"as code". A normal preg_replace can do the same.
The pattern looks a bit different but really does have the exact same
effect as before.
Change-Id: I3597d632f2ecbe5b7ccef39a394075327c9bea79
These are not widely used anywhere, but linking to an #h- heading ID
that doesn't exist should say "topic not found" rather than
"comment not found".
Change-Id: Ifd269cc72e640f36431f85c751874ca06229ba9f
Replacing legacy breakpoint variables with new Codex
design system `@max-width-breakpoint-*` tokens.
Bug: T331403
Change-Id: Ib1ff07a7692948b1fd22e9620c132133d392dab9
We support highlighter HeadingItem's despite saying CommentItem
in a bunch of places.
Also potentially show the "not found" notification if the URL hash
starts "h-" as well as "c-".
Change-Id: I51894902bfca405bbdec89806bb9c1d76e0b40ef
All features should be enabled by default for 3rd party installs.
I74ecd243 ensures this will have no effect on WMF wikis.
Depends-On: I74ecd2438c86d99b5727de488c928cc7d37da6db
Change-Id: Ia3245902abf2601f53065f1ffb94133d7b25e223
MediaWiki's PHPCS plugin requires documentation comments on all
properties, unless those properties are typed.
This has potential to introduce bugs – in particular, because typed
properties without a default value will throw an exception if their
value is accessed before it's defined, while previously they defaulted
to null. I fixed this when I found it (making them nullable and null
by default), but I may have missed some cases.
Change-Id: If5b1f4d542ce3e1b69327ee4283f7c3e133a62a0
Why:
- Per T338534, we want to display the overflow menu next to topics and
comments. Supporting topic-level placement is a little more
complicated, so just go with comments for now.
What:
- Rework the is-mobile check to allow the code to run on desktop/mobile,
while excluding topic-level replacement on desktop (T342627)
Bug: T338534
Bug: T342625
Change-Id: I520c377120e16aa3a6fedcc8c39075958a942e4c