Make consistent the name/id flag handling between name and id. Keep id's in a TreeOrderedArray like names. Only create content lists when needed, and deal with them lazily. This avoids some work during bind / unbind, and fixes the issue here, which is that AfterSetAttr(id) on nsGenericHTMLElement was relying on the id flag being already correct. This fixes a long-standing issue with sorting of named HTML collections. I added a WPT because it wasn't covered by it. Differential Revision: https://phabricator.services.mozilla.com/D311398