Libraryless. Click here for Pure Java version (2583L/17K).
// if <head> block exists: put tag after <head> // if not: add tag in front of the whole HTML sS hAddToHead(S html, S tag) { L<S> tok = htmlTok(html); L<S> head = first(findContainerTag(tok, "head")); if (head == null) ret tag + html; head.set(2, addLineBreak(tag) + head.get(2)); ret join(tok); }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1008417 |
| Snippet name: | hAddToHead - insert tag in <head> |
| Eternal ID of this version: | #1008417/3 |
| Text MD5: | 9ab12cbbaf4704035b1793b5db38e695 |
| Transpilation MD5: | 234e5dbb9e4f028a8c4e675c8204b46a |
| Author: | stefan |
| Category: | javax / html |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-06-05 16:33:03 |
| Source code size: | 315 bytes / 9 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 885 / 1012 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |