informatique:javascript:tests_de_compatibilite
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
informatique:javascript:tests_de_compatibilite [04/05/2018 20:34] – [Is javascript works ?] cyrille | informatique:javascript:tests_de_compatibilite [05/05/2018 19:17] (Version actuelle) – cyrille | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
====== Is javascript works ? ====== | ====== Is javascript works ? ====== | ||
+ | |||
+ | Should be write ' | ||
< | < | ||
Ligne 8: | Ligne 10: | ||
</ | </ | ||
- | If it's not writed OK, no javascript available. | + | ====== toLocaleDateString() ====== |
- | ====== Object.assign() ====== | + | < |
+ | < | ||
+ | var d = ' | ||
+ | document.write('< | ||
+ | d = new Date(Date.parse(d)); | ||
+ | document.write('< | ||
+ | document.write('< | ||
+ | </ | ||
+ | </ | ||
- | ===== Assign simple with scalar properties | + | ===== Workaround |
< | < | ||
< | < | ||
- | var o1 = { a:1 }; | + | function date_as_slug( date ) |
- | var o2 = Object.assign( o1, { b:2 } ); | + | { |
+ | var y = date.getFullYear(), | ||
+ | | ||
+ | d = date.getDate(), | ||
+ | h = date.getHours(), | ||
+ | mn = date.getMinutes(); | ||
+ | | ||
+ | } | ||
+ | |||
+ | document.write( '< | ||
+ | |||
+ | var date = ' | ||
+ | d = new Date(Date.parse(date)); | ||
+ | document.write('< | ||
+ | |||
+ | date = ' | ||
+ | d = new Date(Date.parse(date)); | ||
+ | document.write('< | ||
- | document.write( '< | ||
</ | </ | ||
</ | </ | ||
- | ===== Assign simple with complex | + | ====== Object copy ====== |
+ | |||
+ | ===== Object.assign() - only scalar | ||
+ | |||
+ | Should be write 1,2 : | ||
< | < | ||
< | < | ||
- | var o1 = { a:1 }; | + | try { |
- | var o2 = Object.assign( o1, { b:function(){ return 2;} } ); | + | var o1 = { a:1 }; |
+ | var o2 = Object.assign( o1, { b:2 } ); | ||
+ | | ||
+ | } catch ( e ){ | ||
+ | | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
- | document.write( '< | + | ===== Object.assign() - complex properties ===== |
+ | |||
+ | Should be write 1,2 : | ||
+ | |||
+ | < | ||
+ | < | ||
+ | try { | ||
+ | var o1 = { a:1 }; | ||
+ | var o2 = Object.assign( o1, { b: | ||
+ | document.write( '< | ||
+ | } catch ( e ){ | ||
+ | | ||
+ | } | ||
</ | </ | ||
</ | </ | ||
+ | |||
+ | ===== Object.create() - complex properties ===== | ||
+ | |||
+ | Should be write 1,2 : | ||
+ | |||
+ | < | ||
+ | < | ||
+ | try { | ||
+ | var o1 = { a:1, b: | ||
+ | var o2 = Object.create( o1 ); | ||
+ | | ||
+ | } catch ( e ){ | ||
+ | | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
informatique/javascript/tests_de_compatibilite.1525458881.txt.gz · Dernière modification : 04/05/2018 20:34 de cyrille