4

When I create a simple HTML Element,

var div = document.createElement('div');

I am unable to set the type attribute.

div.setAttribute('type', 'whatever');

Will LockerService someday support that?

7
  • No official, but it would support these except some actionable attributes like onclick , onchange
    – Ashwani
    Mar 17, 2017 at 17:58
  • What error does the locker throw ? Mar 17, 2017 at 18:42
  • No error is thrown by Locker. It says it's not supported and will be ignored. Mar 17, 2017 at 18:49
  • If you can screenshot exact error its not hard to trace it back here github.com/forcedotcom/aura/blob/master/aura-impl/src/main/… . The docs show this must be supported but we can dig in Mar 17, 2017 at 18:52
  • 1
    The exact error is WARNING: SecureElement: [object HTMLDivElement]{ key: {"namespace":"c"} } does not allow getting/setting the type attribute, ignoring!. I know why it's not working, LockerService code is not that huge, but they don't accept any PRs so I cannot fix it myself. Mar 17, 2017 at 19:28

1 Answer 1

2

type isn't a standard attribute on HTMLDivElement. LockerService will ignore these non-standard attribute names, with some exceptions. Anything with a dash in the name, for example, is allowed to accommodate data-* and 3rd party attributes like ng-*.

https://git.soma.salesforce.com/aura/aura/blob/master/aura-impl/src/main/resources/aura/locker/SecureElement.js#L436

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .