2

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?

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
khany
  • 1,167
  • 15
  • 33

1 Answers1

3

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';
Community
  • 1
  • 1
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567