def style(self, style: _AttrValueType) -> None:
        """Set style attribute of this node.

        If argument ``style`` is string, it will be parsed to
        ``CSSStyleDeclaration``.
        """
        if isinstance(style, str):
            self.__style._parse_str(style)
        elif style is None:
            self.__style._parse_str('')
        elif isinstance(style, CSSStyleDeclaration):
            self.__style._owner = None
            if style._owner is not None:
                new_style = CSSStyleDeclaration(owner=self)
                new_style.update(style)
                self.__style = new_style
            else:
                # always making new decl may be better
                style._owner = self
                self.__style = style
        else:
            raise TypeError('Invalid type for style: {}'.format(type(style)))
def style ( self , style : _AttrValueType ) -> None : if isinstance ( style , str ) : self . __style . _parse_str ( style ) elif style is None : self . __style . _parse_str ( '' ) elif isinstance ( style , CSSStyleDeclaration ) : self . __style . _owner = None if style . _owner is not None : new_style = CSSStyleDeclaration ( owner = self ) new_style . update ( style ) self . __style = new_style else : style . _owner = self self . __style = style else : raise TypeError ( 'Invalid type for style: {}' . format ( type ( style ) ) )
Set style attribute of this node.

        If argument ``style`` is string, it will be parsed to
        ``CSSStyleDeclaration``.