~ubuntuone-hackers/pyquery/trunk

« back to all changes in this revision

Viewing changes to pyquery/pyquery.py

  • Committer: Gael Pasgrimaud
  • Date: 2017-12-26 13:25:47 UTC
  • Revision ID: git-v1:70ac35e1f7d68220bd910d07d8d6c90243801889
fix docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
963
963
    # CORE UI EFFECTS #
964
964
    ###################
965
965
    def hide(self):
966
 
        """remove display:none to elements style
 
966
        """Remove display:none to elements style:
967
967
 
968
968
            >>> print(PyQuery('<div style="display:none;"/>').hide())
969
969
            <div style="display: none"/>
972
972
        return self.css('display', 'none')
973
973
 
974
974
    def show(self):
975
 
        """add display:block to elements style
 
975
        """Add display:block to elements style:
976
976
 
977
977
            >>> print(PyQuery('<div />').show())
978
978
            <div style="display: block"/>
1383
1383
 
1384
1384
    @with_camel_case_alias
1385
1385
    def replace_with(self, value):
1386
 
        """replace nodes by value::
 
1386
        """replace nodes by value:
1387
1387
 
1388
1388
            >>> doc = PyQuery("<html><div /></html>")
1389
1389
            >>> node = PyQuery("<span />")
1435
1435
    def remove(self, expr=no_default):
1436
1436
        """Remove nodes:
1437
1437
 
1438
 
         >>> h = '<div>Maybe <em>she</em> does <strong>NOT</strong> know</div>'
1439
 
         >>> d = PyQuery(h)
1440
 
         >>> d('strong').remove()
1441
 
         [<strong>]
1442
 
         >>> print(d)
1443
 
         <div>Maybe <em>she</em> does   know</div>
 
1438
             >>> h = (
 
1439
             ... '<div>Maybe <em>she</em> does <strong>NOT</strong> know</div>'
 
1440
             ... )
 
1441
             >>> d = PyQuery(h)
 
1442
             >>> d('strong').remove()
 
1443
             [<strong>]
 
1444
             >>> print(d)
 
1445
             <div>Maybe <em>she</em> does   know</div>
1444
1446
        """
1445
1447
        if expr is no_default:
1446
1448
            for tag in self: