Logo Search packages:      
Sourcecode: calibre version File versions

def cssutils::css::cssstyledeclaration::CSSStyleDeclaration::removeProperty (   self,
  name,
  normalize = True 
)

(DOM)
Used to remove a CSS property if it has been explicitly set within
this declaration block.

:param name:
    of the CSS property
:param normalize:
    if ``True`` (DEFAULT) name will be normalized (lowercase, no simple
    escapes) so "color", "COLOR" or "C\olor" will all be equivalent.
    The effective Property value is returned and *all* Properties
    with ``Property.name == name`` are removed.

    If ``False`` may return **NOT** the effective value but the 
    effective for the unnormalized `name` only. Also only the 
    Properties with the literal name `name` are removed.
:returns:
    the value of the property if it has been explicitly set for
    this declaration block. Returns the empty string if the property
    has not been set or the property name does not correspond to a
    known CSS property


:exceptions:
    - :exc:`~xml.dom.NoModificationAllowedErr`:
      Raised if this declaration is readonly or the property is
      readonly.

Definition at line 496 of file cssstyledeclaration.py.

00496                                                   :
        """
        (DOM)
        Used to remove a CSS property if it has been explicitly set within
        this declaration block.

        :param name:
            of the CSS property
        :param normalize:
            if ``True`` (DEFAULT) name will be normalized (lowercase, no simple
            escapes) so "color", "COLOR" or "C\olor" will all be equivalent.
            The effective Property value is returned and *all* Properties
            with ``Property.name == name`` are removed.

            If ``False`` may return **NOT** the effective value but the 
            effective for the unnormalized `name` only. Also only the 
            Properties with the literal name `name` are removed.
        :returns:
            the value of the property if it has been explicitly set for
            this declaration block. Returns the empty string if the property
            has not been set or the property name does not correspond to a
            known CSS property


        :exceptions:
            - :exc:`~xml.dom.NoModificationAllowedErr`:
              Raised if this declaration is readonly or the property is
              readonly.
        """
        self._checkReadonly()
        r = self.getPropertyValue(name, normalize=normalize)
        newseq = self._tempSeq()
        if normalize:
            # remove all properties with name == nname
            nname = self._normalize(name)
            for item in self.seq:
                if not (isinstance(item.value, Property) and item.value.name == nname):
                    newseq.appendItem(item)
        else:
            # remove all properties with literalname == name
            for item in self.seq:
                if not (isinstance(item.value, Property) and item.value.literalname == name):
                    newseq.appendItem(item)
        self._setSeq(newseq)
        return r

    def setProperty(self, name, value=None, priority=u'', normalize=True):


Generated by  Doxygen 1.6.0   Back to index