x-tag / core

The Heart of X-Tag
http://x-tag.github.io/
Other
1.25k stars 151 forks source link

strange behavior with extends #109

Closed francescoagati closed 9 years ago

francescoagati commented 9 years ago

hi, i have a strange behavior with extends property and xtag.register with 1.0 release. with the property "extends" the the callbacks created and inserted are not executed. if i omit this they are executed. is changed the spec? There is a changelog with spec changes?

pennyfx commented 9 years ago

The custom element spec requires you to specify the type you are extending when calling document.createElement. See the following test.

https://github.com/x-tag/core/blob/master/spec/core.js#L1214

francescoagati commented 9 years ago

ok but i don't use create-element. i insert the tag directly in the dom with a template.

this are 2 example with webcomponent inline in html page with and without extends:

without extends works http://jsfiddle.net/c4mbapdL/1/

and with extends don't work http://jsfiddle.net/c4mbapdL/2/

i don't understand why with extends don't work?

Thanks Francesco

2014-11-17 20:07 GMT+01:00 Arron Schaar notifications@github.com:

The custom element spec requires you to specify the type you are extending when calling document.createElement. See the following test.

https://github.com/x-tag/core/blob/master/spec/core.js#L1214

— Reply to this email directly or view it on GitHub https://github.com/x-tag/core/issues/109#issuecomment-63357093.

francescoagati commented 9 years ago

maybe i don't use platform.js?

2014-11-17 20:14 GMT+01:00 francesco agati francescoagati1975@gmail.com:

ok but i don't use create-element. i insert the tag directly in the dom with a template.

this are 2 example with webcomponent inline in html page with and without extends:

without extends works http://jsfiddle.net/c4mbapdL/1/

and with extends don't work http://jsfiddle.net/c4mbapdL/2/

i don't understand why with extends don't work?

Thanks Francesco

2014-11-17 20:07 GMT+01:00 Arron Schaar notifications@github.com:

The custom element spec requires you to specify the type you are extending when calling document.createElement. See the following test.

https://github.com/x-tag/core/blob/master/spec/core.js#L1214

— Reply to this email directly or view it on GitHub https://github.com/x-tag/core/issues/109#issuecomment-63357093.

pennyfx commented 9 years ago

I added a test that confirms the issue.
https://github.com/x-tag/core/commit/40b774d030d8ca7a3ffb7c79a6bd871061449346

@csuwildcat Can you check this out?

Lochlan commented 9 years ago

Don't you have to use the is attribute for this to work? http://jsfiddle.net/c4mbapdL/3/

See here: https://github.com/x-tag/core/issues/76#issuecomment-41218168

francescoagati commented 9 years ago

maybe. but i remember that in old versions of x-tags (i speak about january 2014) the attribute is was added automatically with a custom tag

csuwildcat commented 9 years ago

You must use the is="" attribute when you extend an element, which means your example would look like this in use:

<div is="x-foo"></div>

On Mon, Nov 17, 2014 at 5:08 PM, francesco agati notifications@github.com wrote:

maybe. but i remember that in old versions of x-tags (i speak about january 2014) the attribute is was added automatically

Reply to this email directly or view it on GitHub https://github.com/x-tag/core/issues/109#issuecomment-63406452.

pennyfx commented 9 years ago

@csuwildcat That does work. For some reason I thought it was opposite.

<x-superelem is="div"></x-superelem> My bad. Test updated.

francescoagati commented 9 years ago

Ok. I must use "is" if i dont use extends. What is the reason of is? In the last documentation i dont find "is". For web components inline when is the case of using "is"?

----- Messaggio originale ----- Da: "Arron Schaar" notifications@github.com Inviato: ‎19/‎11/‎2014 00:55 A: "x-tag/core" core@noreply.github.com Cc: "francesco agati" francescoagati1975@gmail.com Oggetto: Re: [core] strange behavior with extends (#109)

Closed #109. — Reply to this email directly or view it on GitHub.=

pennyfx commented 9 years ago

If you do extend an existing element then you need to use is="my-element" I believe it has something to do with re-bootstrapping a prototype.

FWIW, I've made about 100 components and I've never used extends, so I never run into this use case.

csuwildcat commented 9 years ago

No, you only use is="" If you ARE extending an existing element.

On Tue, Nov 18, 2014, 4:29 PM francesco agati notifications@github.com wrote:

Ok. I must use "is" if i dont use extends. What is the reason of is? In the last documentation i dont find "is". For web components inline when is the case of using "is"?

----- Messaggio originale ----- Da: "Arron Schaar" notifications@github.com Inviato: 19/11/2014 00:55 A: "x-tag/core" core@noreply.github.com Cc: "francesco agati" francescoagati1975@gmail.com Oggetto: Re: [core] strange behavior with extends (#109)

Closed #109.

Reply to this email directly or view it on GitHub.=

Reply to this email directly or view it on GitHub https://github.com/x-tag/core/issues/109#issuecomment-63572245.

francescoagati commented 9 years ago

hi, thanks for the support. i notice that my webcomponents work correctly with 0.7.10 version of -xtag. but they dosn't work with 1.0 version.

this is an example of my webcomponents are implemented:

the js/coffee code

  xtag.register "connection",
    extends: "div"
    lifecycle:
      created: ->

and the instantiation in html

<connection id="connection-t"  category="" ></connection>
csuwildcat commented 9 years ago

@francescoagati Custom Elements require a dash in the tag name - this is a standard spec requirement, not an X-Tag thing: http://w3c.github.io/webcomponents/spec/custom/#concepts