Skip to content

Commit

Permalink
Do not assume input within label (fixes #174)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyve committed Dec 6, 2019
1 parent cb4574a commit d1bcefc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/bootstrap4/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,10 @@ def list_to_class(self, html, klass):
soup = BeautifulSoup(html, features="html.parser")
for label in soup.find_all("label"):
label.attrs["class"] = label.attrs.get("class", []) + ["form-check-label"]
label.input.attrs["class"] = label.input.attrs.get("class", []) + ["form-check-input"]
try:
label.input.attrs["class"] = label.input.attrs.get("class", []) + ["form-check-input"]
except AttributeError:
pass
return str(soup)

def add_checkbox_label(self, html):
Expand Down

0 comments on commit d1bcefc

Please sign in to comment.