<commit_before>/* *************************************************************************************************
 Element+ClassSelector.swift
   © 2019 YOCKOW.
     Licensed under MIT License.
     See "LICENSE.txt" for more information.
 ************************************************************************************************ */

extension Element {
  /// The class to select a class that the parser will use to create element instances.
  /// The registered classes will not be used
  /// if the namespace of the QName of the element is not XHTML's.
  public final class ClassSelector {
    private init() {}
    public static let `default`: ClassSelector = .init()
    
    private var _list:[NoncolonizedName:Element.Type] = [
      "body":BodyElement.self,
      "head":HeadElement.self,
      "input":InputElement.self,
      "title":TitleElement.self,
    ]
    
    /// Register `class` for the element whose local name is `localName`.
    public func register(_ class:Element.Type, for localName:NoncolonizedName) {
      self._list[localName] = `class`
    }
    
    internal func _class(for localName:NoncolonizedName) -> Element.Type? {
      return self._list[localName]
    }
  }
}

internal protocol _ElementClassSelector {}
extension Element: _ElementClassSelector {}
extension _ElementClassSelector {
  internal init(name:QualifiedName,
                attributes:Attributes,<commit_msg>[XHTML] Add `FormElement` to `Element.ClassSelector`.<commit_after>/* *************************************************************************************************
 Element+ClassSelector.swift
   © 2019 YOCKOW.
     Licensed under MIT License.
     See "LICENSE.txt" for more information.
 ************************************************************************************************ */

extension Element {
  /// The class to select a class that the parser will use to create element instances.
  /// The registered classes will not be used
  /// if the namespace of the QName of the element is not XHTML's.
  public final class ClassSelector {
    private init() {}
    public static let `default`: ClassSelector = .init()
    
    private var _list:[NoncolonizedName:Element.Type] = [
      "body":BodyElement.self,
      "form":FormElement.self,
      "head":HeadElement.self,
      "input":InputElement.self,
      "title":TitleElement.self,
    ]
    
    /// Register `class` for the element whose local name is `localName`.
    public func register(_ class:Element.Type, for localName:NoncolonizedName) {
      self._list[localName] = `class`
    }
    
    internal func _class(for localName:NoncolonizedName) -> Element.Type? {
      return self._list[localName]
    }
  }
}

internal protocol _ElementClassSelector {}
extension Element: _ElementClassSelector {}
extension _ElementClassSelector {
  internal init(name:QualifiedName,
                attributes:Attributes,
{'fraction_non_alphanumeric': 0.2172117039586919, 'fraction_numerical': 0.002753872633390706, 'mean_word_length': 3.8192371475953566, 'pattern_counts': {'":': 9, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2554508', 'n_tokens_mistral': 738, 'n_tokens_neox': 702, 'n_words': 214}