diff options
Diffstat (limited to 'files/es/web/api/cssstylesheet')
-rw-r--r-- | files/es/web/api/cssstylesheet/deleterule/index.html | 21 | ||||
-rw-r--r-- | files/es/web/api/cssstylesheet/index.html | 64 | ||||
-rw-r--r-- | files/es/web/api/cssstylesheet/insertrule/index.html | 119 | ||||
-rw-r--r-- | files/es/web/api/cssstylesheet/ownerrule/index.html | 19 |
4 files changed, 223 insertions, 0 deletions
diff --git a/files/es/web/api/cssstylesheet/deleterule/index.html b/files/es/web/api/cssstylesheet/deleterule/index.html new file mode 100644 index 0000000000..f11a905d98 --- /dev/null +++ b/files/es/web/api/cssstylesheet/deleterule/index.html @@ -0,0 +1,21 @@ +--- +title: Stylesheet.deleteRule +slug: Web/API/CSSStyleSheet/deleteRule +translation_of: Web/API/CSSStyleSheet/deleteRule +--- +<p>{{ ApiRef() }}</p> +<h3 id="Summary" name="Summary">Resumen</h3> +<p>El método <strong>deleteRule</strong> elimina una regla de la hoja de estilos actual.</p> +<h3 id="Syntax" name="Syntax">Sintaxis</h3> +<pre class="eval">stylesheet.deleteRule(<em>index</em>) +</pre> +<h3 id="Parameters" name="Parameters">Parámetros</h3> +<ul> + <li><code>index</code> es un numero de tipo long, que indica la posición de la regla.</li> +</ul> +<h3 id="Example" name="Example">Ejemplo</h3> +<pre> myStyles.deleteRule(0); +</pre> +<h3 id="Specification" name="Specification">Especificación</h3> +<p><a class="external" href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.html#CSS-CSSStyleSheet-deleteRule">deleteRule </a></p> +<p>{{ languages( { "pl": "pl/DOM/stylesheet.deleteRule" } ) }}</p> diff --git a/files/es/web/api/cssstylesheet/index.html b/files/es/web/api/cssstylesheet/index.html new file mode 100644 index 0000000000..f9781136ae --- /dev/null +++ b/files/es/web/api/cssstylesheet/index.html @@ -0,0 +1,64 @@ +--- +title: CSSStyleSheet +slug: Web/API/CSSStyleSheet +translation_of: Web/API/CSSStyleSheet +--- +<p>{{ ApiRef() }}</p> +<p> </p> +<p>This section describes the <a class="external" href="http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleSheet">CSSStyleSheet</a> object, which represents a single CSS stylesheet.</p> +<p>A CSS stylesheet consists of CSS rules, each of them can be manipulated through its <a href="/en/DOM/cssRule" title="en/DOM/cssRule">CSSRule</a> object. The stylesheet object itself lets you examine and modify the stylesheet, including its list of rules.</p> +<p>You can get the list of stylesheets for a given document using the <a href="/en/DOM/document.styleSheets" title="en/DOM/document.styleSheets">document.styleSheets</a> property.</p> +<h3 id="Properties" name="Properties">Properties</h3> +<dl> + <dt> + <a href="/en/DOM/stylesheet.cssRules" title="en/DOM/stylesheet.cssRules">stylesheet.cssRules</a></dt> + <dd> + Returns all of the CSS rules in the stylesheet as an array.</dd> + <dt> + <a href="/en/DOM/stylesheet.disabled" title="en/DOM/stylesheet.disabled">stylesheet.disabled</a></dt> + <dd> + This property indicates whether the current stylesheet has been applied or not.</dd> + <dt> + <a href="/en/DOM/stylesheet.href" title="en/DOM/stylesheet.href">stylesheet.href</a></dt> + <dd> + Returns the location of the stylesheet.</dd> + <dt> + <a href="/en/DOM/stylesheet.media" title="en/DOM/stylesheet.media">stylesheet.media</a></dt> + <dd> + Specifies the intended destination medium for style information.</dd> + <dt> + <a href="/en/DOM/stylesheet.ownerNode" title="en/DOM/stylesheet.ownerNode">stylesheet.ownerNode</a></dt> + <dd> + Returns the node that associates this style sheet with the document.</dd> + <dt> + <a href="/en/DOM/stylesheet.ownerRule" title="en/DOM/stylesheet.ownerRule">stylesheet.ownerRule</a></dt> + <dd> + If this style sheet comes from an @import rule, the ownerRule property will contain the CSSImportRule.</dd> + <dt> + <a href="/en/DOM/stylesheet.parentStyleSheet" title="en/DOM/stylesheet.parentStyleSheet">stylesheet.parentStyleSheet</a></dt> + <dd> + Returns the stylesheet that is including this one, if any.</dd> + <dt> + <a href="/en/DOM/stylesheet.title" title="en/DOM/stylesheet.title">stylesheet.title</a></dt> + <dd> + Returns the advisory title of the current style sheet.</dd> + <dt> + <a href="/en/DOM/stylesheet.type" title="en/DOM/stylesheet.type">stylesheet.type</a></dt> + <dd> + Specifies the style sheet language for this style sheet.</dd> +</dl> +<h3 id="Methods" name="Methods">Methods</h3> +<dl> + <dt> + <a href="/en/DOM/stylesheet.deleteRule" title="en/DOM/stylesheet.deleteRule">stylesheet.deleteRule</a></dt> + <dd> + Deletes a rule from the stylesheet.</dd> + <dt> + <a href="/en/DOM/stylesheet.insertRule" title="en/DOM/stylesheet.insertRule">stylesheet.insertRule</a></dt> + <dd> + Inserts a new style rule into the current style sheet.</dd> +</dl> +<h3 id="Specification" name="Specification">Specification</h3> +<p><a class="external" href="http://www.w3.org/TR/DOM-Level-2-Style/stylesheets.html#StyleSheets-StyleSheet">DOM Level 2 Style Sheets: StyleSheet</a></p> +<p><a class="external" href="http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleSheet">DOM Level 2 CSS: CSSStyleSheet</a></p> +<p>{{ languages( { "pl": "pl/DOM/stylesheet" } ) }}</p> diff --git a/files/es/web/api/cssstylesheet/insertrule/index.html b/files/es/web/api/cssstylesheet/insertrule/index.html new file mode 100644 index 0000000000..ef0f3e522d --- /dev/null +++ b/files/es/web/api/cssstylesheet/insertrule/index.html @@ -0,0 +1,119 @@ +--- +title: CSSStyleSheet.insertRule() +slug: Web/API/CSSStyleSheet/insertRule +tags: + - CSSStyleSheet +translation_of: Web/API/CSSStyleSheet/insertRule +--- +<div> + {{APIRef}}</div> +<p><span style="color: rgb(77, 78, 83);">El método </span><code style="font-size: 14px; color: rgb(77, 78, 83);"><strong>CSSStyleSheet.insertRule()</strong></code><span style="color: rgb(77, 78, 83);"> inserta una nueva regla de estilo en la actual hoja de estilos.</span></p> +<p><span style="color: rgb(77, 78, 83);">Para conjuntos de reglas ésta contiene tanto al selector como la declaración de estilo. Para reglas-arroba, ésta especifica tanto al identificador-arroba como como al contenido de la regla. Si se asignan varias reglas en el </span>{{domxref("DOMString")}}<span style="color: rgb(77, 78, 83);"> como parámetro se dispara una </span><span style="font-family: 'Courier New', 'Andale Mono', monospace; line-height: normal;"> </span><span style="line-height: 1.5;">{{domxref("DOMException")}}</span><span style="line-height: 1.5;"> con el código </span><span style="font-family: 'Courier New', 'Andale Mono', monospace; line-height: normal;">SYNTAX_ERR</span><span style="line-height: 1.5;">.</span></p> +<h2 id="Syntax" name="Syntax">Syntax</h2> +<pre class="syntaxbox"><var>stylesheet</var>.insertRule(<var>regla</var>, índice)</pre> +<h3 id="Parameters" name="Parameters">Parameters</h3> +<ul> + <li><code>regla</code> es un {{domxref("DOMString")}} que contiene la regla que se va a insertar (selector y declaración).</li> + <li><font face="Courier New, Andale Mono, monospace"><span style="line-height: normal;">índice</span></font> es un <code>unsigned int</code> que representa la posicion en la que se va a insertar.</li> +</ul> +<h2 id="Examples" name="Examples">Ejemplos</h2> +<h3 id="Example_1" name="Example_1">Ejemplo 1</h3> +<pre class="brush: js">// Insertar una nueva regla al principio de mi hoja de estilos +myStyle.insertRule("#blanc { color: white }", 0); +</pre> +<h3 id="Example_2" name="Example_2">Example 2</h3> +<pre class="brush: js">/** + * Agregar una regla de hoja de estilos al documento(sin embargo, una mejor práctica puede ser + * cambiar las clases dinamicamente, así se mantiene la información de estilo en + * hojas de estilo genuinas (evitando agregar elementos extras al DOM)) + * Note que se necesita una matriz para las declaraciones y reglas ya que ECMAScript + * no proporciona un orden de iteración predecible y como CSS + * depende del <span style="line-height: normal;">orden</span><span style="line-height: normal;">(i.e., es cascada); aquellos sin necesidad de</span> + * reglas en cascada podrían construir una API basada en objetos de acceso más amigable. + * @param {Matriz} reglas. Acepta una matriz de declaraciones JSON-encoded + * @example +addStylesheetRules([ + ['h2', // Acepta un segundo argumento como una matriz de matrices + ['color', 'red'], + ['background-color', 'green', true] // 'true' para reglas !important + ], + ['.myClass', ['background-color', 'yellow'] + ] +]); + */ +function addStylesheetRules (decls) { + var styleEl = document.createElement('style'); + document.head.appendChild(styleEl); + // Aparentemente ¿alguna versión de Safari necesita la siguiente linea? No lo sé. + styleEl.appendChild(document.createTextNode('')); + var s = styleEl.sheet; + for (var i=0, rl = rules.length; i < rl; i++) { + var j = 1, rule = rules[i], selector = decl[0], propStr = ''; + // Si el segundo argumento de una regla es una matriz de matrices, corrijamos nuestras variables. + if (Object.prototype.toString.call(rule[1][0]) === '[object Array]') { + rule = rule[1]; + j = 0; + } + for (var pl=rule.length; j < pl; j++) { + var prop = rule[j]; + propStr += prop[0] + ':' + prop[1] + (prop[2] ? ' !important' : '') + ';\n'; + } + s.insertRule(selector + '{' + propStr + '}', s.cssRules.length); + } +}</pre> +<h2 id="Specification" name="Specification">Specification</h2> +<ul> + <li><a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.html#CSS-CSSStyleSheet-insertRule">insertRule </a></li> +</ul> +<h2 id="Browser_compatibility" style="line-height: 30px;">Browser compatibility</h2> +<p>{{ CompatibilityTable() }}</p> +<div id="compat-desktop"> + <table class="compat-table"> + <tbody> + <tr> + <th style="line-height: 16px;">Feature</th> + <th style="line-height: 16px;">Chrome</th> + <th style="line-height: 16px;">Firefox (Gecko)</th> + <th style="line-height: 16px;">Internet Explorer</th> + <th style="line-height: 16px;">Opera</th> + <th style="line-height: 16px;">Safari</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{ CompatVersionUnknown() }}</td> + <td>{{ CompatVersionUnknown() }}</td> + <td>8</td> + <td>{{ CompatVersionUnknown() }}</td> + <td>{{ CompatVersionUnknown() }}</td> + </tr> + </tbody> + </table> +</div> +<div id="compat-mobile"> + <table class="compat-table"> + <tbody> + <tr> + <th style="line-height: 16px;">Feature</th> + <th style="line-height: 16px;">Android</th> + <th style="line-height: 16px;">Chrome for Android</th> + <th style="line-height: 16px;">Firefox Mobile (Gecko)</th> + <th style="line-height: 16px;">IE Mobile</th> + <th style="line-height: 16px;">Opera Mobile</th> + <th style="line-height: 16px;">Safari Mobile</th> + </tr> + <tr> + <td>Basic support</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="/en-US/docs/Web/API/CSSStyleSheet/deleteRule"><code>deleteRule</code></a></li> +</ul> diff --git a/files/es/web/api/cssstylesheet/ownerrule/index.html b/files/es/web/api/cssstylesheet/ownerrule/index.html new file mode 100644 index 0000000000..cd8c302ce3 --- /dev/null +++ b/files/es/web/api/cssstylesheet/ownerrule/index.html @@ -0,0 +1,19 @@ +--- +title: Stylesheet.ownerRule +slug: Web/API/CSSStyleSheet/ownerRule +--- +<p>{{ ApiRef() }}</p> +<h3 id="Summary" name="Summary">Resumen</h3> +<p>Si esta hoja de estilos viene de una regla <code>@import</code>, la propiedad <strong>ownerRule </strong>contendrá la CSSImportRule.</p> +<h3 id="Syntax" name="Syntax">Sintaxis</h3> +<pre class="eval"><em>rule</em> = stylesheet.ownerRule +</pre> +<h3 id="Parameters" name="Parameters">Parámetros</h3> +<ul> + <li><code>rule</code> es una cadena que contiene la regla de importación en el documento HTML o XML.</li> +</ul> +<h3 id="Notes" name="Notes">Notas</h3> +<p>Ten en cuenta que si el valor de la propiedad ownerNode en el elemento <a href="/es/DOM/element.style" title="es/DOM/element.style">STYLE</a> actual es NULL, el valor <strong>ownerRule </strong>devolverá !!TODO!! y viceversa.</p> +<h3 id="Specification" name="Specification">Specification</h3> +<p><a class="external" href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.html#CSS-CSSStyleSheet-ownerRule">ownerRule </a></p> +<p>{{ languages( { "pl": "pl/DOM/stylesheet.ownerRule" } ) }}</p> |