newTab isn't a tab at all, it's inner contents of an LI, so now called innerLI 2nd insertBefore should be inserting newText not newLI again New code to get CSS values via regex Now only showing the preview if the caretLocType is CSS