Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support case-sensitive HTML elements #140

Open
marcoroth opened this issue Apr 22, 2023 · 0 comments
Open

Support case-sensitive HTML elements #140

marcoroth opened this issue Apr 22, 2023 · 0 comments

Comments

@marcoroth
Copy link
Owner

Even while it's encouraged to use Kebab-case for HTML-tags there are some use-cases where we have case-sensitive HTML elements, like in SVG (see #139). This would also allow to cleanup the special-handling we have for handling SVG elements in:

subchild.name = SVG_ELEMENTS[subchild.name] if SVG_ELEMENTS.key?(subchild.name)

Since we are using Nokogiri::HTML4::DocumentFragment for parsing the source it automatically casts all tag names to lowercase. While Nokogiri::HTML5::DocumentFragment would support case-sensitive tags, it doesn't support other things like properly detecting boolean attributes (see #119 and #120).

ERB Input:

<customElement>
 <anotherElement/>
</customElement>

Output:

class CustomelementComponent < Phlex::HTML
  register_element :anotherelement
  register_element :customelement

  def template
    customelement { anotherelement }
  end
end

Expected output:

class CustomelementComponent < Phlex::HTML
  register_element :anotherElement
  register_element :customElement

  def template
    customElement { anotherElement }
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant