diff --git a/html5lib/filters/optionaltags.py b/html5lib/filters/optionaltags.py
index fefe0b30..dab0574a 100644
--- a/html5lib/filters/optionaltags.py
+++ b/html5lib/filters/optionaltags.py
@@ -58,7 +58,7 @@ def is_optional_start(self, tagname, previous, next):
elif tagname == 'colgroup':
# A colgroup element's start tag may be omitted if the first thing
# inside the colgroup element is a col element, and if the element
- # is not immediately preceeded by another colgroup element whose
+ # is not immediately preceded by another colgroup element whose
# end tag has been omitted.
if type in ("StartTag", "EmptyTag"):
# XXX: we do not look at the preceding event, so instead we never
@@ -70,7 +70,7 @@ def is_optional_start(self, tagname, previous, next):
elif tagname == 'tbody':
# A tbody element's start tag may be omitted if the first thing
# inside the tbody element is a tr element, and if the element is
- # not immediately preceeded by a tbody, thead, or tfoot element
+ # not immediately preceded by a tbody, thead, or tfoot element
# whose end tag has been omitted.
if type == "StartTag":
# omit the thead and tfoot elements' end tag when they are
diff --git a/html5lib/html5parser.py b/html5lib/html5parser.py
index 12aa6a35..63250338 100644
--- a/html5lib/html5parser.py
+++ b/html5lib/html5parser.py
@@ -2564,7 +2564,7 @@ def endTagFrameset(self, token):
self.tree.openElements.pop()
if (not self.parser.innerHTML and
self.tree.openElements[-1].name != "frameset"):
- # If we're not in innerHTML mode and the the current node is not a
+ # If we're not in innerHTML mode and the current node is not a
# "frameset" element (anymore) then switch.
self.parser.phase = self.parser.phases["afterFrameset"]
diff --git a/html5lib/inputstream.py b/html5lib/inputstream.py
index 7020aa60..ec191ab0 100644
--- a/html5lib/inputstream.py
+++ b/html5lib/inputstream.py
@@ -469,7 +469,7 @@ def detectEncoding(self, parseMeta=True, chardet=True):
if encoding is None and parseMeta:
encoding = self.detectEncodingMeta()
confidence = "tentative"
- # Guess with chardet, if avaliable
+ # Guess with chardet, if available
if encoding is None and chardet:
confidence = "tentative"
try:
diff --git a/html5lib/tests/support.py b/html5lib/tests/support.py
index 41f2d2a0..dbb735a9 100644
--- a/html5lib/tests/support.py
+++ b/html5lib/tests/support.py
@@ -16,10 +16,10 @@
from html5lib import treebuilders
del base_path
-# Build a dict of avaliable trees
+# Build a dict of available trees
treeTypes = {"DOM": treebuilders.getTreeBuilder("dom")}
-# Try whatever etree implementations are avaliable from a list that are
+# Try whatever etree implementations are available from a list that are
#"supposed" to work
try:
import xml.etree.ElementTree as ElementTree
diff --git a/html5lib/treebuilders/etree_lxml.py b/html5lib/treebuilders/etree_lxml.py
index c6c981f9..2755c485 100644
--- a/html5lib/treebuilders/etree_lxml.py
+++ b/html5lib/treebuilders/etree_lxml.py
@@ -315,7 +315,7 @@ def insertRoot(self, token):
"""Create the document root"""
# Because of the way libxml2 works, it doesn't seem to be possible to
# alter information like the doctype after the tree has been parsed.
- # Therefore we need to use the built-in parser to create our iniial
+ # Therefore we need to use the built-in parser to create our initial
# tree, after which we can add elements like normal
docStr = ""
if self.doctype:
diff --git a/html5lib/utils.py b/html5lib/utils.py
index fdc18feb..ebad29fb 100644
--- a/html5lib/utils.py
+++ b/html5lib/utils.py
@@ -64,7 +64,7 @@ def __getitem__(self, key):
return dict.get(self, key, self.default)
-# Some utility functions to dal with weirdness around UCS2 vs UCS4
+# Some utility functions to deal with weirdness around UCS2 vs UCS4
# python builds
def isSurrogatePair(data):
diff --git a/utils/spider.py b/utils/spider.py
index a7b80319..ac5f9fbe 100644
--- a/utils/spider.py
+++ b/utils/spider.py
@@ -80,7 +80,7 @@ def updateURLs(self, tree):
except KeyError:
pass
- #Remove all non-http URLs and a dd a sutiable base URL where that is
+ #Remove all non-http URLs and add a suitable base URL where that is
#missing
newUrls = set()
for url in urls: