prepend value to nodes
(self, value)
| 1246 | return self |
| 1247 | |
| 1248 | def prepend(self, value): |
| 1249 | """prepend value to nodes |
| 1250 | """ |
| 1251 | root, root_text = self._get_root(value) |
| 1252 | for i, tag in enumerate(self): |
| 1253 | if not tag.text: |
| 1254 | tag.text = '' |
| 1255 | if len(root) > 0: |
| 1256 | root[-1].tail = tag.text |
| 1257 | tag.text = root_text |
| 1258 | else: |
| 1259 | tag.text = root_text + tag.text |
| 1260 | if i > 0: |
| 1261 | root = deepcopy(list(root)) |
| 1262 | tag[:0] = root |
| 1263 | root = tag[:len(root)] |
| 1264 | return self |
| 1265 | |
| 1266 | @with_camel_case_alias |
| 1267 | def prepend_to(self, value): |