@@ -338,28 +338,10 @@ public static <T> void ensureCustomElement(final T elem, String... imports) {
338338 return ;
339339 }
340340
341- // Delay this so as the developer gets an early version of the element and
342- // can assign properties soon.
343- new Timer () {
344- public void run () {
345- // We need to remove ownProperties from the element when it's not
346- // registered because a bug in Polymer 1.0.x
347- // https://github.com/Polymer/polymer/issues/1882
348- saveProperties ((Element )elem );
349- }
350- }.schedule (0 );
351341 // Import all necessary stuff for this element
352342 for (String src : imports ) {
353343 importHref (src , null , null );
354344 }
355- // Wait until everything is ready
356- whenReady (new Function (){
357- public Object call (Object arg ) {
358- // Restore saved ownProperties
359- restoreProperties ((Element )elem );
360- return null ;
361- }
362- }, (Element )elem );
363345 }
364346
365347 /**
@@ -409,24 +391,6 @@ public static void updateStyles() {
409391 Polymer .updateStyles ();
410392 }
411393
412- /**
413- * Restore all properties saved previously to the element was
414- * registered.
415- *
416- * Hack for: https://github.com/Polymer/polymer/issues/1882
417- */
418- private static native void restoreProperties (Element e )
419- /*-{
420- if (e && e.__o) {
421- @com.vaadin.polymer.Polymer::onReady(*)(e, function(){
422- for (i in e.__o) {
423- e[i] = e.__o[i];
424- }
425- delete e.__o;
426- });
427- }
428- }-*/ ;
429-
430394 /**
431395 * Executes a function after all imports have been loaded.
432396 */
@@ -489,33 +453,6 @@ private static void onReady(Element e, Object f) {
489453 whenReady ((Function )f , e );
490454 }
491455
492- /**
493- * Read all element properties and save in a JS object in the element,
494- * so as we can restore then once the element is registered.
495- *
496- * We consider all ownProperties but those beginning or ending with '_'
497- * which is the symbol used by webcomponentjs to store private info.
498- *
499- * Hack for: https://github.com/Polymer/polymer/issues/1882
500- *
501- * TODO: this is a temporary workaround, and if the issue is not fixed in
502- * polymer we could eventually implement the fix based on a generated proxy
503- * per component to store for a while any method call.
504- */
505- private static native boolean saveProperties (Element e )
506- /*-{
507- if (!@com.vaadin.polymer.Polymer::isRegisteredElement(*)(e)) {
508- var o = {};
509- for (i in e) {
510- if (e.hasOwnProperty(i) && !/(^_|_$)/.test(i)) {
511- o[i] = e[i];
512- delete(e[i]);
513- e.__o = o;
514- }
515- }
516- }
517- }-*/ ;
518-
519456 /**
520457 * Utility method to show a loading element if there is no one in
521458 * hosting page.
0 commit comments