Leave rule off for now as manual fixes are required.
Also temporarily disable prefer-const rule as that
will also require some manual fixes.
Change-Id: I8c3478f26f51287acb943bd38c9c1020c06b9f39
The PHP code should never see a `<span class="mw-headline">` node
since MediaWiki change If04d72f427ec3c3730e757cbb3ade8840c09f7d3,
but we have to support it for our old integration tests (T363031).
Improve code comments to explain this and move the handling to
one place, so that it can be deleted more easily in the future.
Follow-up to 08f61b2609.
Change-Id: I5ab9d3373a6911c1456c30d844b66576b278a1b5
When an arrow function body contains just a single `return` statement,
the braces can be omitted.
(Changes are mostly made by `grunt eslint --fix`, with only some line
breaks added by hand.)
Change-Id: I37f259f87085c8d20ed09cfa58a8456dd36cdc38
Similar reasoning for our existing filter on just `/`; it's only really
used in state routing.
Bug: T361322
Change-Id: Ibcf1a58a884b953003012640041471d3bb5c9450
Top is in the WHATWG spec as a magic value that always navigates to the
top of the document.
There used to be a #top element in pre-Vector2022 skins, and it's in
fairly wide use on some wikis in signatures and via gadgets, so many
links exist that point to it.
Bug: T360274
Change-Id: Ia12464239ab2cdc428c570d0cf5df1c0d1780b7a
We no longer need to support toggling visual enhancements without
reloading the page, so we can remove the extraneous set of buttons
to reduce HTML size.
Bug: T322457
Change-Id: I54e57c754c54b7e611069f9832d1ebabf141a396
We need to more carefully wait for mobile section toggling to happen.
Follow-up to 3957d7ac25.
Bug: T338920
Change-Id: I1bd31483c5be9428075f07494e89b06f19f8bf23
MediaWiki should never generate links like this, but users or 3rd
party tools probably create them accidentally quite regularly, and
we do a similar thing with Title normalisation.
Change-Id: Ia467f422578bcb9b4d3fb8feab0b85f4b6436f7e
This is still an experimental feature and not deployed
anywhere, but as we mute the timestamp to indicate it
is more part of the interface than the content, we should
do the same with this overflow menu button.
Change-Id: I30391912377692fffa9e67e8c4ca63db715878bf
In certain cases the parser could go back rather than forward after
finding a signature, causing it to find the same signature forever
until it ran out of memory.
Test cases coming later in a separate patch.
Bug: T356884
Change-Id: I8ac72b05e5e4ed45e6119c012a69708c9d8eda29
Follow-up to 8a8c7270cf.
I think this wasn't working becase we were doing it in the wrong
order (reply tool initialization would disable toggling section
state before toggler toggled it open).
Bug: T338920
Change-Id: I7ed3d5c149ddb3d33cb67010f032c63e175687f2
* Keep the information about this in the API result, which we were
previously omitting
* Use it instead of duplicating the logic client-side
Bug: T356131
Change-Id: I7e7342e9d94a171b5ef56e646871c18c8c39c44c
`decodeURI( fragment )` can throw if the fragment isn't correctly
encoded – e.g. when it's just '#%'.
Use mw.util.percentDecodeFragment() instead, which uses a more
resilient algorithm.
Change-Id: I8447771ad2ae33da52b71d4127981dd8a2018a7d
Section titles containing non-ASCII characters were being passed through
URL-encoded, resulting in no results being found.
Bug: T356199
Change-Id: Iac56ee434a37baf3d170aec992d2f2d8679b6f1f
This will be present in parser cache output and can
sometimes be mistaken for user page links.
Bug: T356142
Change-Id: I800b23d8466f72affcadfa336aab07abf7f8d79e
results[ 0 ] would be undefined, causing a later JS error before the
toast could be shown.
Bug: T355165
Change-Id: Ia591a1e4db0acfa377201c355938a32f680393ce
This prevents an exception being thrown if you open the
new topic tool when a reply widget is still loading.
Change-Id: I17da48ddf91394d05cc82613ce5517f1e176750b
Also rename CommentController#teardown to onReplyWidgetTeardown,
and NewTopicController#clear(Storage) to onReplyWidgetClear(Storage).
Change-Id: Ib1dd50ca69aac6f1836674d1a6aefa2402844c57
We shouldn't assume callers of this method have waited
for the replyWidget to be built.
Bug: T354292
Change-Id: Ic66b4f04b8786b07f520e329adda37efcf498dad
Makes the class more similar to PHP. The non-native
ranges exist for efficiency, but users will usually
want native ranges.
Change-Id: Ifd7dd034d2e0f3b9af050ecdab3e063df73dde5e
* Looks for heading IDs matching "h-<heading text>-%" that once
existed on the target page.
* For such IDs, finds where those items currently exist,
presumably in an archive.
Pros:
* Doesn't need to know anything about the local wiki's archiving
conventions, so can be deployed universally.
Cons:
* ID conflicts will return matches in unrelated archives, e.g.
MassMessages.
Bug: T349653
Change-Id: Ie94efd0503e9f4689d3421babe445f9f4e2b4fb7
* The :first-child pseudo-selector to suppress top border of the first
div.ext-discussiontools-init-section ends up suppressing top borders
of all these divs since they are the first child of a <section> tag
in Parsoid's HTML.
Add `.mw-parser-output >` to these selectors, so that they don't apply
when <section> wrappers are present in Parsoid's HTML.
* Re-implement the logic for suppressing top border with new selectors
that work correctly with Parsoid's <section> wrappers.
Note that one of the cases requires using the :has() selector, which
is not supported by all browsers yet. This should not be a big deal
in practice, as that case should be rare on Wikimedia projects.
* This can be reverted if T333031 decides to strip <section> tags
from Parsoid's read view HTML.
Bug: T333031
Bug: T341010
Change-Id: If513c90033e9a77c8885b3b1c937e016064cc5ba
(split off from I5ab9d3373a6911c1456c30d844b66576b278a1b5)
Bug: T13555
Depends-On: I44587461582d648b56ef0c9c7ae0c322895c69c2
Change-Id: Ia32d3b3ac0de2f17401fc1a26c1fe451f273c688
This was being overridden by a later rule that only affected reply
buttons on mobile.
Bug: T351542
Change-Id: Iad2f6b703827cccf46ad5909d11fe3912d7023d5
This was causing a misalignment on mobile pages that loaded the DT
styles but didn't have visual enhancements enabled.
Bug: T351044
Change-Id: Ib5e392943331467c3d29ee2b10d3bbe4995137d0
This requires something like an invalid timestamp, to produce a reply
link whose associated comment ID is going to not be findable.
Bug: T350633
Change-Id: Ib50c11096b9af9961b74309b60524a4b986e04aa
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
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
Saying that ctrl-enter would submit the post at a moment when it
wouldn't may be confusing to users.
Bug: T326500
Change-Id: Ib513c8a6c36a0f607cc2034fc830dbfcdf10f554