0

I'm using polymer 1.0 in my web application.

In my first component attributes-cmp.html, I have defined my function as desctibed below

getAttributes : function(jsonParams){
                //my code
},

In my second component I called the method

var elt = document.getElementById(eltId);
elt.getAttributes(jsonParams);

I got the error

SCRIPT438: Object doesn't support property or method 'getAttributes'.

This is work fine on google chrome but not on MS Edge

I have already added the portion of code to load the polyfills

if ('registerElement' in document
      && 'import' in document.createElement('link')
      && 'content' in document.createElement('template')) {
    // platform is good!
  } else {
    // polyfill the platform!
    var e = document.createElement('script');
    e.src = '/bower_components/webcomponentsjs/webcomponents-lite.min.js';
    document.body.appendChild(e);
  }
e2rabi
  • 4,728
  • 9
  • 42
  • 69
  • did you extend the `Element` prototype to include the `getAttributes` method? – Derek Pollard Mar 23 '18 at 18:08
  • What you are effectively trying to call is a method named `getAttributes` that exists as a method provided by the `Element`, and unless you made that with extending the prototype, it will not exist – Derek Pollard Mar 23 '18 at 18:10
  • @Derek can you please explain more how to extends the Element to include getAttributes ? – e2rabi Mar 23 '18 at 21:58
  • Here is a good SO QA https://stackoverflow.com/questions/14034180/why-is-extending-native-objects-a-bad-practice – Derek Pollard Apr 20 '18 at 04:41

0 Answers0