diff options
Diffstat (limited to 'files/it/conflicting/web/javascript/reference/global_objects')
-rw-r--r-- | files/it/conflicting/web/javascript/reference/global_objects/object/index.html | 215 | ||||
-rw-r--r-- | files/it/conflicting/web/javascript/reference/global_objects/string/index.html | 179 |
2 files changed, 394 insertions, 0 deletions
diff --git a/files/it/conflicting/web/javascript/reference/global_objects/object/index.html b/files/it/conflicting/web/javascript/reference/global_objects/object/index.html new file mode 100644 index 0000000000..568165d0be --- /dev/null +++ b/files/it/conflicting/web/javascript/reference/global_objects/object/index.html @@ -0,0 +1,215 @@ +--- +title: Object.prototype +slug: Web/JavaScript/Reference/Global_Objects/Object/prototype +translation_of: Web/JavaScript/Reference/Global_Objects/Object +translation_of_original: Web/JavaScript/Reference/Global_Objects/Object/prototype +--- +<div>{{JSRef("Global_Objects", "Object")}}</div> + +<h2 id="Summary" name="Summary">Sommario</h2> + +<p>La proprietà <strong><code>Object.prototype</code></strong> rappresenta l'oggetto prototipo di {{jsxref("Global_Objects/Object", "Object")}}.</p> + +<p>{{js_property_attributes(0, 0, 0)}}</p> + +<h2 id="Description" name="Description">Descrizione</h2> + +<p>In JavaScript, tutti gli oggetti sono discendenti di {{jsxref("Global_Objects/Object", "Object")}}; tutti gli oggetti ereditano metodi e proprietà di <code>Object.prototype</code> (tranne nel caso l'oggetto abbia il prototipo uguale a {{jsxref("Global_Objects/null", "null")}}, quindi creati con il metodo {{jsxref("Object.create", "Object.create(null)")}}), anche se questi possono essere sovrascritti. Per esempio, i prototipi degli altri costruttori sovrascrivono la proprietà <code>constructor</code> e forniscono un loro metodo {{jsxref("Object.prototype.toString", "toString()")}}. I cambiamenti al prototipo di Object vengono estesi a tutti gli oggetti, eccetto quelli che sovrascrivono le proprietà e i metodi cambiati.</p> + +<h2 id="Properties" name="Properties">Proprietà</h2> + +<dl> + <dt>{{jsxref("Object.prototype.constructor")}}</dt> + <dd>Specifica la funzione che ha creato l'oggetto a partire dal prototipo.</dd> + <dt>{{jsxref("Object.prototype.__proto__")}} {{non-standard_inline}}</dt> + <dd>È un riferimento all'oggetto usato come prototipo quando l'oggetto è stato istanziato.</dd> + <dt>{{jsxref("Object.prototype.__noSuchMethod__")}} {{non-standard_inline}}</dt> + <dd>Permette di definire una funzione che venga chiamata quando viene chiamato un metodo non definito.</dd> + <dt><s class="obsoleteElement">{{jsxref("Object.prototype.__count__")}} {{obsolete_inline}}</s></dt> + <dd><s class="obsoleteElement">Rappresenta il numero di proprietà persenti in un oggetto, ma è stato rimosso.</s></dd> + <dt><s class="obsoleteElement">{{jsxref("Object.prototype.__parent__")}} {{obsolete_inline}}</s></dt> + <dd><s class="obsoleteElement">Rappresenta il contesto di un oggetto, ma è stato rimosso.</s></dd> +</dl> + +<h2 id="Methods" name="Methods">Metodi</h2> + +<dl> + <dt>{{jsxref("Object.prototype.__defineGetter__()")}} {{non-standard_inline}} {{deprecated_inline}}</dt> + <dd>Associa una funzione a una proprietà di un oggetto. Quando si tenta di leggere il valore di tale proprietà, viene eseguita la funzione e restituito il valore che restituisce.</dd> + <dt>{{jsxref("Object.prototype.__defineSetter__()")}} {{non-standard_inline}} {{deprecated_inline}}</dt> + <dd>Associa una funzione a una proprietà di un oggetto. Quando si tenta di cambiare il valore di tale proprietà, viene eseguita la funzione.</dd> + <dt>{{jsxref("Object.prototype.__lookupGetter__()")}} {{non-standard_inline}} {{deprecated_inline}}</dt> + <dd>Restituisce la funzione definita tramite {{jsxref("Object.prototype.defineGetter", "__defineGetter__()")}}.</dd> + <dt>{{jsxref("Object.prototype.__lookupSetter__()")}} {{non-standard_inline}} {{deprecated_inline}}</dt> + <dd>Restituisce la funzione definita tramite {{jsxref("Object.prototype.defineSetter", "__defineSetter__()")}}.</dd> + <dt>{{jsxref("Object.prototype.hasOwnProperty()")}}</dt> + <dd>Determina se l'oggetto contiene direttamente una proprietà (non ereditata tramite il prototipo).</dd> + <dt>{{jsxref("Object.prototype.isPrototypeOf()")}}</dt> + <dd>Determina se un oggetto fa parte della catena dei prototipi dell'oggetto sul quale è richiamato questo metodo.</dd> + <dt>{{jsxref("Object.prototype.propertyIsEnumerable()")}}</dt> + <dd>Determina se l'<a href="/it/docs/ECMAScript_DontEnum_attribute" title="ECMAScript_DontEnum_attribute">attributo DontEnum di ECMAScript</a> interno è presente.</dd> + <dt>{{jsxref("Object.prototype.toSource()")}} {{non-standard_inline}}</dt> + <dd>Restituisce una stringa contenente il codice sorgente di un oggetto rappresentante l'oggetto sul quale questo metodo viene richiamato; puoi usare questo valore per creare un nuovo oggetto.</dd> + <dt>{{jsxref("Object.prototype.toLocaleString()")}}</dt> + <dd>Richiama {{jsxref("Object.prototype.toString", "toString()")}}.</dd> + <dt>{{jsxref("Object.prototype.toString()")}}</dt> + <dd>Restituisce la rappresentazione dell'oggetto sotto forma di stringa.</dd> + <dt>{{jsxref("Object.prototype.unwatch()")}} {{non-standard_inline}}</dt> + <dd>Termina di osservare i cambiamenti di una proprietà dell'oggetto.</dd> + <dt>{{jsxref("Object.prototype.valueOf()")}}</dt> + <dd>Ritorna il valore primitivo dell'oggetto.</dd> + <dt>{{jsxref("Object.prototype.watch()")}} {{non-standard_inline}}</dt> + <dd>Inizia a osservare i cambiamenti di una proprietà di un oggetto.</dd> + <dt><s class="obsoleteElement">{{jsxref("Object.prototype.eval()")}} {{obsolete_inline}}</s></dt> + <dd><s class="obsoleteElement">Esegue una stringa di codice JavaScript nel contesto dell'oggetto, ma è stato rimosso.</s></dd> +</dl> + +<h2 id="Examples" name="Examples">Esempi</h2> + +<p>Siccome in JavaScript gli oggetti non sono sub-classabili in modo "standard", il prototipo è una soluzione utile per creare un oggetto che funzioni da "classe di base" che contenga dei metodi comuni a più oggetti. Per esempio:</p> + +<pre class="brush: js">var Persona = function() { + this.saParlare = true; +}; + +Persona.prototype.saluta = function() { + if (this.saParlare) { + console.log('Ciao, mi chiamo ' + this.nome); + } +}; + +var Dipendente = function(nome, titolo) { + Persona.call(this); + this.nome = nome; + this.titolo = titolo; +}; + +Dipendente.prototype = Object.create(Persona.prototype); +Dipendente.prototype.constructor = Dipendente; + +Dipendente.prototype.saluta = function() { + if (this.saParlare) { + console.log('Ciao mi chiamo ' + this.nome + ' e lavoro come ' + this.titolo); + } +}; + +var Cliente = function(nome) { + Persona.call(this); + this.nome = nome; +}; + +Cliente.prototype = Object.create(Persona.prototype); +Cliente.prototype.constructor = Cliente; + +var Mimo = function(nome) { + Persona.call(this); + this.nome = nome; + this.saParlare = false; +}; + +Mimo.prototype = Object.create(Persona.prototype); +Mimo.prototype.constructor = Mimo; + +var bob = new Dipendente('Bob', 'Architetto'); +var joe = new Cliente('Joe'); +var rg = new Dipendente('Red Green', 'Tuttofare'); +var mike = new Cliente('Mike'); +var mime = new Mimo('Mimo'); +bob.saluta(); +joe.saluta(); +rg.saluta(); +mike.saluta(); +mime.saluta(); +</pre> + +<p>Stamperà:</p> + +<pre>Ciao, mi chiamo Bob e lavoro come Architetto +Ciao, mi chiamo Joe +Ciao, mi chiamo Red Green, e lavoro come Tuttofare +Ciao, mi chiamo Mike</pre> + +<h2 id="Specifications" name="Specifications">Specifiche</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specifica</th> + <th scope="col">Stato</th> + <th scope="col">Commenti</th> + </tr> + <tr> + <td>ECMAScript 1st Edition. Implemented in JavaScript 1.0.</td> + <td>Standard</td> + <td>Definizione iniziale.</td> + </tr> + <tr> + <td>{{SpecName('ES5.1', '#sec-15.2.3.1', 'Object.prototype')}}</td> + <td>{{Spec2('ES5.1')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES6', '#sec-object.prototype', 'Object.prototype')}}</td> + <td>{{Spec2('ES6')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">Compatibilità con i browser</h2> + +<div>{{CompatibilityTable}}</div> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Funzionalità</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Supporto di base</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th><span style="font-family: open sans light,sans-serif; font-size: 16px; line-height: 16px;">Funzionalità</span></th> + <th>Android</th> + <th>Chrome for Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td><span style="font-size: 12px; line-height: 18px;">Supporto di base</span></td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a href="/it/docs/Web/JavaScript/Introduction_to_Object-Oriented_JavaScript">Introduzione alla programmazione JavaScript orientata agli oggetti</a></li> +</ul> diff --git a/files/it/conflicting/web/javascript/reference/global_objects/string/index.html b/files/it/conflicting/web/javascript/reference/global_objects/string/index.html new file mode 100644 index 0000000000..c83cec2a54 --- /dev/null +++ b/files/it/conflicting/web/javascript/reference/global_objects/string/index.html @@ -0,0 +1,179 @@ +--- +title: String.prototype +slug: Web/JavaScript/Reference/Global_Objects/String/prototype +translation_of: Web/JavaScript/Reference/Global_Objects/String +translation_of_original: Web/JavaScript/Reference/Global_Objects/String/prototype +--- +<div>{{JSRef}}</div> + +<p>La proprietà <strong><code>String.prototype</code></strong>rappresenta l'oggetto prototipo {{jsxref("String")}}.</p> + +<div>{{js_property_attributes(0, 0, 0)}}</div> + +<h2 id="Description">Description</h2> + +<p>Tutte le istanze {{jsxref("String")}} ereditano da <code>String.prototype</code> . Le modifiche all'oggetto prototipo <code>String</code> vengono propagate a tutte le istanze {{jsxref("String")}}.</p> + +<h2 id="Properties">Properties</h2> + +<dl> + <dt><code>String.prototype.constructor</code></dt> + <dd>Specifica la funzione che crea il prototipo di un oggetto.</dd> + <dt>{{jsxref("String.prototype.length")}}</dt> + <dd>Riflette la lunghezza della stringa.</dd> + <dt><code><em>N</em></code></dt> + <dd>Utilizzato per accedere al carattere in <em>N</em> posizione in cui <em>N</em> è un numero intero positivo compreso tra 0 e uno inferiore al valore della {{jsxref("String.length", "length")}}. Queste proprietà sono di sola lettura.</dd> +</dl> + +<h2 id="Metodi">Metodi</h2> + +<h3 id="Metodi_non_correlati_HTML">Metodi non correlati HTML</h3> + +<dl> + <dt>{{jsxref("String.prototype.charAt()")}}</dt> + <dd>Restituisce il carattere (esattamente un'unità di codice UTF-16) all'indice specificato</dd> + <dt>{{jsxref("String.prototype.charCodeAt()")}}</dt> + <dd>Restituisce un numero che corrisponde al valore dell'unità di codice UTF-16 nell'indice specificato.</dd> + <dt>{{jsxref("String.prototype.codePointAt()")}}</dt> + <dd>Restituisce un numero intero non negativo <strong>Numero</strong> che è il valore del punto di codice codificato UTF-16 che inizia con l'indice specificato.</dd> + <dt>{{jsxref("String.prototype.concat()")}}</dt> + <dd>Combina il testo di due stringhe e restituisce una nuova stringa.</dd> + <dt>{{jsxref("String.prototype.includes()")}}</dt> + <dd>Determina se una stringa può essere trovata all'interno di un'altra stringa.</dd> + <dt>{{jsxref("String.prototype.endsWith()")}}</dt> + <dd>Determina se una stringa termina con i caratteri di un'altra stringa.</dd> + <dt>{{jsxref("String.prototype.indexOf()")}}</dt> + <dd>Restituisce l'indice all'interno dell'oggetto {{jsxref("String")}} chiamante della prima occorrenza del valore specificato o -1 se non trovato.</dd> + <dt>{{jsxref("String.prototype.lastIndexOf()")}}</dt> + <dd>Restituisce l'indice all'interno dell'oggetto {{jsxref("String")}} chiamante della prima occorrenza del valore specificato o -1 se non trovato.</dd> + <dt>{{jsxref("String.prototype.localeCompare()")}}</dt> + <dd>Restituisce un numero che indica se una stringa di riferimento viene prima o dopo o è uguale alla stringa specificata in ordine di ordinamento.</dd> + <dt>{{jsxref("String.prototype.match()")}}</dt> + <dd>Utilizzato per abbinare un'espressione regolare a una stringa.</dd> + <dt>{{jsxref("String.prototype.normalize()")}}</dt> + <dd>Restituisce il modulo di normalizzazione Unicode del valore della stringa chiamante.</dd> + <dt>{{jsxref("String.prototype.padEnd()")}}</dt> + <dd>Riempie la stringa corrente dalla fine con una determinata stringa per creare una nuova stringa di una determinata lunghezza.</dd> + <dt>{{jsxref("String.prototype.padStart()")}}</dt> + <dd>Riempie la stringa corrente dall'inizio con una determinata stringa per creare una nuova stringa da una determinata lunghezza.</dd> + <dt><s class="obsoleteElement">{{jsxref("String.prototype.quote()")}} {{obsolete_inline}}</s></dt> + <dd><s class="obsoleteElement">Avvolge la stringa tra virgolette ("<code>"</code>").</s></dd> + <dt>{{jsxref("String.prototype.repeat()")}}</dt> + <dd>Restituisce una stringa composta da elementi dell'oggetto ripetuti i tempi indicati.</dd> + <dt>{{jsxref("String.prototype.replace()")}}</dt> + <dd>Utilizzato per trovare una corrispondenza tra un'espressione regolare e una stringa e per sostituire la sottostringa con corrispondenza con una nuova sottostringa.</dd> + <dt>{{jsxref("String.prototype.search()")}}</dt> + <dd>Esegue la ricerca di una corrispondenza tra un'espressione regolare e una stringa specificata.</dd> + <dt>{{jsxref("String.prototype.slice()")}}</dt> + <dd>Estrae una sezione di una stringa e restituisce una nuova stringa.</dd> + <dt>{{jsxref("String.prototype.split()")}}</dt> + <dd>Divide un oggetto {{jsxref("Global_Objects/String", "String")}} in una matrice di stringhe separando la stringa in sottostringhe.</dd> + <dt>{{jsxref("String.prototype.startsWith()")}}</dt> + <dd>Determina se una stringa inizia con i caratteri di un'altra stringa.</dd> + <dt>{{jsxref("String.prototype.substr()")}} {{deprecated_inline}}</dt> + <dd>Restituisce i caratteri in una stringa che inizia nella posizione specificata attraverso il numero specificato di caratteri.</dd> + <dt>{{jsxref("String.prototype.substring()")}}</dt> + <dd>Restituisce i caratteri in una stringa tra due indici nella stringa.</dd> + <dt>{{jsxref("String.prototype.toLocaleLowerCase()")}}</dt> + <dd>I caratteri all'interno di una stringa vengono convertiti in minuscolo rispettando le impostazioni locali correnti. Per la maggior parte delle lingue, questo restituirà lo stesso di {{jsxref("String.prototype.toLowerCase()", "toLowerCase()")}}.</dd> + <dt>{{jsxref("String.prototype.toLocaleUpperCase()")}}</dt> + <dd>I caratteri all'interno di una stringa vengono convertiti in maiuscolo rispettando le impostazioni locali correnti. Per la maggior parte delle lingue, ciò restituirà lo stesso di {{jsxref("String.prototype.toUpperCase()", "toUpperCase()")}}.</dd> + <dt>{{jsxref("String.prototype.toLowerCase()")}}</dt> + <dd>Restituisce il valore della stringa chiamante convertito in minuscolo.</dd> + <dt>{{jsxref("String.prototype.toSource()")}} {{non-standard_inline}}</dt> + <dd>Restituisce un oggetto letterale che rappresenta l'oggetto specificato; puoi usare questo valore per creare un nuovo oggetto. Sostituisce il metodo {{jsxref("Object.prototype.toSource()")}} method.</dd> + <dt>{{jsxref("String.prototype.toString()")}}</dt> + <dd>Restituisce una stringa che rappresenta l'oggetto specificato. Sostituisce il metodo {{jsxref("Object.prototype.toString()")}} .</dd> + <dt>{{jsxref("String.prototype.toUpperCase()")}}</dt> + <dd>Restituisce il valore della stringa chiamante convertito in maiuscolo.</dd> + <dt>{{jsxref("String.prototype.trim()")}}</dt> + <dd>Taglia gli spazi bianchi all'inizio e alla fine della stringa. Parte dello standard ECMAScript 5.</dd> + <dt>{{jsxref("String.prototype.trimStart()")}}<br> + {{jsxref("String.prototype.trimLeft()")}}</dt> + <dd>Taglia gli spazi bianchi dall'inizio della stringa.</dd> + <dt>{{jsxref("String.prototype.trimEnd()")}}<br> + {{jsxref("String.prototype.trimRight()")}}</dt> + <dd>Taglia gli spazi bianchi dalla fine della stringa.</dd> + <dt>{{jsxref("String.prototype.valueOf()")}}</dt> + <dd>Restituisce il valore primitivo dell'oggetto specificato. Sostituisce il metodo {{jsxref("Object.prototype.valueOf()")}}.</dd> + <dt>{{jsxref("String.prototype.@@iterator()", "String.prototype[@@iterator]()")}}</dt> + <dd>Restituisce un nuovo oggetto <code>Iterator</code> che itera sopra i punti di codice di un valore String, restituendo ogni punto di codice come valore String.</dd> +</dl> + +<h3 id="HTML_metodi_wrapper_(involucro)">HTML metodi wrapper (involucro)</h3> + +<p>Questi metodi sono di uso limitato, in quanto forniscono solo un sottoinsieme dei tag e degli attributi HTML disponibili.</p> + +<dl> + <dt>{{jsxref("String.prototype.anchor()")}} {{deprecated_inline}}</dt> + <dd>{{htmlattrxref("name", "a", "<a name=\"name\">")}} (hypertext target)</dd> + <dt>{{jsxref("String.prototype.big()")}} {{deprecated_inline}}</dt> + <dd>{{HTMLElement("big")}}</dd> + <dt>{{jsxref("String.prototype.blink()")}} {{deprecated_inline}}</dt> + <dd>{{HTMLElement("blink")}}</dd> + <dt>{{jsxref("String.prototype.bold()")}} {{deprecated_inline}}</dt> + <dd>{{HTMLElement("b")}}</dd> + <dt>{{jsxref("String.prototype.fixed()")}} {{deprecated_inline}}</dt> + <dd>{{HTMLElement("tt")}}</dd> + <dt>{{jsxref("String.prototype.fontcolor()")}} {{deprecated_inline}}</dt> + <dd>{{htmlattrxref("color", "font", "<font color=\"color\">")}}</dd> + <dt>{{jsxref("String.prototype.fontsize()")}} {{deprecated_inline}}</dt> + <dd>{{htmlattrxref("size", "font", "<font size=\"size\">")}}</dd> + <dt>{{jsxref("String.prototype.italics()")}} {{deprecated_inline}}</dt> + <dd>{{HTMLElement("i")}}</dd> + <dt>{{jsxref("String.prototype.link()")}} {{deprecated_inline}}</dt> + <dd>{{htmlattrxref("href", "a", "<a href=\"url\">")}} (link to URL)</dd> + <dt>{{jsxref("String.prototype.small()")}} {{deprecated_inline}}</dt> + <dd>{{HTMLElement("small")}}</dd> + <dt>{{jsxref("String.prototype.strike()")}} {{deprecated_inline}}</dt> + <dd>{{HTMLElement("strike")}}</dd> + <dt>{{jsxref("String.prototype.sub()")}} {{deprecated_inline}}</dt> + <dd>{{HTMLElement("sub")}}</dd> + <dt>{{jsxref("String.prototype.sup()")}} {{deprecated_inline}}</dt> + <dd>{{HTMLElement("sup")}}</dd> +</dl> + +<h2 id="Specificazioni">Specificazioni</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specificazioni</th> + <th scope="col">Stato</th> + <th scope="col">Commento</th> + </tr> + <tr> + <td>{{SpecName('ES1')}}</td> + <td>{{Spec2('ES1')}}</td> + <td>Definizione iniziale.</td> + </tr> + <tr> + <td>{{SpecName('ES5.1', '#sec-15.5.3.1', 'String.prototype')}}</td> + <td>{{Spec2('ES5.1')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES6', '#sec-string.prototype', 'String.prototype')}}</td> + <td>{{Spec2('ES6')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ESDraft', '#sec-string.prototype', 'String.prototype')}}</td> + <td>{{Spec2('ESDraft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilità_con_il_browser">Compatibilità con il browser</h2> + +<p class="hidden"> tabella di compatibilità in questa pagina è generata da dati strutturati. Se desideri contribuire ai dati, consulta <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> e inviaci una richiesta di pull.</p> + +<p>{{Compat("javascript.builtins.String.prototype")}}</p> + +<h2 id="Guarda_anche">Guarda anche</h2> + +<ul> + <li>{{jsxref("String")}}</li> + <li>{{jsxref("Function.prototype")}}</li> +</ul> |