Content: Content bug: BatteryManager includes "Additional methods in Mozilla chrome codebase" from EventTarget

Created on 20 Mar 2021  Â·  4Comments  Â·  Source: mdn/content

What page(s) did you find the problem on?

https://developer.mozilla.org/en-US/docs/Web/API/BatteryManager

Specific page section or heading?

https://developer.mozilla.org/en-US/docs/Web/API/BatteryManager#methods

What is the problem?

The source using an include mechanism to inline https://developer.mozilla.org/en-US/docs/Web/API/EventTarget#methods, which includes this section:

https://developer.mozilla.org/en-US/docs/Web/API/EventTarget#additional_methods_in_mozilla_chrome_codebase

What did you expect to see?

Only things which are relevant for BatteryManager. There may be some use to including this information on the EventTarget page, but not on BatteryManager.

WebAPI needs-triage

Most helpful comment

I agree with @wbamberg here. Mentioning the parent, EventTarget, removing the {{page}} macro, and removing Mozilla-isms is the correct thing here.

Also, this is a case of inheritance and not mixins. See https://github.com/mdn/content/issues/1006 for a discussion around documentation conventions for inheritance.

All 4 comments

@wbamberg This is a good test case for discussing page inclusion since the inclusion results in a bug which needs to be fixed.

Would this be covered by the fact that EventTarget is a mixin (ie the discussion here). If so we would document the methods as though they were part of BatteryManager.

@Elchi3 do you have a view on this?

There are a couple of things going on here.

  • BatteryManager inherits from EventTarget. Usually Web API pages handle this by mentioning that fact and linking to the parent, like in, say, https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement#methods. But in this case for no good reason we've decided to handle it by transcluding the pages. We should delete this use of {{page}} and do the normal thing here.

  • EventTarget lists these Mozilla-chrome-specific events. I think we could just delete this section.

In some structured-content nirvana we could automatically slurp properties and methods from a parent into a child.

I agree with @wbamberg here. Mentioning the parent, EventTarget, removing the {{page}} macro, and removing Mozilla-isms is the correct thing here.

Also, this is a case of inheritance and not mixins. See https://github.com/mdn/content/issues/1006 for a discussion around documentation conventions for inheritance.

Great. Fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chunkybanana picture chunkybanana  Â·  3Comments

ydaniv picture ydaniv  Â·  4Comments

jakseb picture jakseb  Â·  3Comments

lychyi picture lychyi  Â·  3Comments

rachelandrew picture rachelandrew  Â·  4Comments