I'm working whith LitElement and AppLocalizeBehavior and I have the following error when I implement AppLocalizeBehavior in LitElement app
---package.json ---
"dependencies": {
"@polymer/app-layout": "^3.0.0",
"@polymer/app-localize-behavior": "^3.0.1",
"@polymer/polymer": "^3.1.0",
"@webcomponents/webcomponentsjs": "^2.2.4",
"lit-element": "^2.0.0-rc.3",
"pwa-helpers": "^0.9.0",
"redux": "^4.0.0",
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0"
},
"devDependencies": {
"@polymer/test-fixture": "^4.0.2",
"axe-core": "^3.0.0",
"chai": "^4.1.2",
"del": "^3.0.0",
"gulp": "^4.0.0",
"gulp-rename": "^1.3.0",
"gulp-replace": "^1.0.0",
"mocha": "^5.2.0",
"pixelmatch": "^4.0.2",
"polymer-cli": "^1.9.3",
"polyserve": "^0.27.0",
"prpl-server": "^1.4.0",
"puppeteer": "^1.5.0",
"wct-mocha": "^1.0.0"
}
--- old my-app.js--
class MyApp extends connect(store)(LitElement) { ....
---AppLocalizeBehavior my-app.js ---
import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js'; import {AppLocalizeBehavior} from '@polymer/app-localize-behavior/app-localize-behavior.js';
class MyApp extends connect(store)(mixinBehaviors([AppLocalizeBehavior],LitElement)) { .....
----- ERROR--------------
updating-element.ts:487 Uncaught TypeError: Cannot read property 'forEach' of undefined
at HTMLElement._saveInstanceProperties (updating-element.ts:487)
at HTMLElement.initialize (updating-element.ts:467)
at HTMLElement.initialize (lit-element.ts:130)
at new UpdatingElement (updating-element.ts:230)
at new LitElement (lit-element.ts:76)
at new PropertiesChanged (properties-changed.js:170)
at new PropertyAccessors (property-accessors.js:115)
at new TemplateStamp (template-stamp.js:125)
at new PropertyEffects (property-effects.js:1195)
at new PropertiesMixin (properties-mixin.js:115)
I was having the same issue for IronValidatorBehavior.
Does't working with PolymerElement and LitElement
Here is the working code for IronValidatorBehavior.
email-validator.js
Then in main component.