I am creating some html elements dynamically with code such as
new ButtonElement()
and its easy to add classes like
..classes.add('dropdown-menu')
I want to add the following html to it
data-toggle="dropdown"
but dart doesn't allow me to do so. If I add a new ElementHtml
like
new ElementHtml('<button data-toggle="dropdown"></button>')
it says it's invalid. I need it for my bootjack dropdown selector.
Any ideas on this?
I think you need a NodeValidator
that has the data-toggle
attribute enabled (see also Dart, why does using innerHtml to set shadow root content work but appendHtml doesn't?)
What you can do without NodeValidator
is
new ButtonElement()..dataset['toggle'] = 'dropdown';