diff options
author | Leonard Richardson <leonardr@segfault.org> | 2016-12-10 14:08:54 -0500 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2016-12-10 14:08:54 -0500 |
commit | b82474b190cf8b741c78a16cd9a80954e7ffae34 (patch) | |
tree | 910f06f049da74488914dd8a925360e4df41e91a /doc/source | |
parent | f71ad1549bdb38701834544952d8352d2c3bf641 (diff) |
Corrected documentation left over from when class was treated as a single-valued attribute. [bug=1631743]
Diffstat (limited to 'doc/source')
-rw-r--r-- | doc/source/index.rst | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/doc/source/index.rst b/doc/source/index.rst index 5572eff..654a3a4 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -360,34 +360,34 @@ Attributes ^^^^^^^^^^ A tag may have any number of attributes. The tag ``<b -class="boldest">`` has an attribute "class" whose value is +id="boldest">`` has an attribute "id" whose value is "boldest". You can access a tag's attributes by treating the tag like a dictionary:: - tag['class'] + tag['id'] # u'boldest' You can access that dictionary directly as ``.attrs``:: tag.attrs - # {u'class': u'boldest'} + # {u'id': 'boldest'} You can add, remove, and modify a tag's attributes. Again, this is done by treating the tag as a dictionary:: - tag['class'] = 'verybold' - tag['id'] = 1 + tag['id'] = 'verybold' + tag['another-attribute'] = 1 tag - # <blockquote class="verybold" id="1">Extremely bold</blockquote> + # <b another-attribute="1" id="verybold"></b> - del tag['class'] del tag['id'] + del tag['another-attribute'] tag - # <blockquote>Extremely bold</blockquote> + # <b></b> - tag['class'] - # KeyError: 'class' - print(tag.get('class')) + tag['id'] + # KeyError: 'id' + print(tag.get('id')) # None .. _multivalue: |