1. Alain Poirier
  2. core

Commits

Alain Poirier  committed c24de16

Change all the `_` by `-` when an attribute begins by `data_`

  • Participants
  • Parent commits 0f362db
  • Branches default

Comments (0)

Files changed (1)

File nagare/namespaces/xhtml_base.py

View file
  • Ignore whitespace
 @peak.rules.when(xml.add_attribute, (_HTMLTag, basestring, basestring))
 def add_attribute(next_method, self, name, value):
     if name.startswith('data_'):
-        name = 'data-' + name[5:]
+        name = name.replace('_', '-')
 
     next_method(self, name, value)