Page MenuHomePhabricator

Document that the second parameter of mw.html.element is optional
Closed, ResolvedPublic

Description

I would never have guessed that the second parameter of mw.html.element is optional by just looking at the source or the documentation, but it is: mw.html.element( 'br' )works and returns '<br/>', so I think it worth to document this.

Details

Event Timeline

Schnark raised the priority of this task from to Needs Triage.
Schnark updated the task description. (Show Details)
Schnark subscribed.

Change 250198 had a related patch set uploaded (by TheDJ):
mw.html: Document which mw.html.elements params are optional

https://gerrit.wikimedia.org/r/250198

I would never have guessed that the second parameter of mw.html.element is optional by just looking at the source or the documentation, but it is: mw.html.element( 'br' )works and returns '<br/>', so I think it worth to document this.

The reason one would not guess from the source/documentation is because it is not supported. If it was supported, then you would see that in the code (even if the documentation is incomplete).

The fact that something works is not indicatory of support. Documentation comes after support, not the other way around.

Having said that, I'm happy to support this. It makes total sense. So let's update the code to reflect this support, including unit tests. After that then we can update the documentation (can be in the same commit of course!).

Change 250198 merged by jenkins-bot:
mw.html: Document mw.html.elements optional parameters

https://gerrit.wikimedia.org/r/250198

@Krinkle the commit that was merged looks like it added tests and updated the documentation - can this be closed?

TheDJ claimed this task.
TheDJ subscribed.

this can definitely be marked as solved yes..