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?

  • No official, but it would support these except some actionable attributes like onclick , onchange
    – Ashwani
    Mar 17 '17 at 17:58
  • What error does the locker throw ? Mar 17 '17 at 18:42
  • No error is thrown by Locker. It says it's not supported and will be ignored. Mar 17 '17 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 '17 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 '17 at 19:28

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-*.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.