Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <button type="button" onclick="walk(document.querySelector('body'))">Walk</button>
<div id="images">
  <a href="#">
    <img alt="Alt" src="">
  <a href="#">
    <img alt="Img Text" src="">
<nav id="nav">
    <li><a href="#" title="About" id="test">About</a></li>
<div id="copyright">
  Copyright © 2020 <a href="">Neo's World</a>, All rights reserved.
<div id="form">
  <textarea rows="1"></textarea>
  <input type="text">
    <optgroup label="Food">
      <option value="tomato">Tomato</option>
      <option value="egg" label="Egg">Tameigou</option>
<p>Author : <a href="">Neo</a></p>


                ul, p, input, select, textarea {
  margin: 0;
  vertical-align: top;



function walk(node, debugDepth) {
  if(debugDepth == null) debugDepth = 0;
  const debugDepthIndent = '.'.repeat(debugDepth);
  switch(node.nodeType) {
		case  1:  // Element
		case  9:  // Document
		case 11:  // Document Fragment
      // 特殊系を先に処理する
      if(['TEXTAREA', 'INPUT'].includes(node.tagName) && !isEmpty(node.value)) {
        node.value = replaceValue(node.value);
        break;  // 子要素なし
      else if(node.tagName === 'IMG' && !isEmpty(node.getAttribute('alt'))) {
        node.setAttribute('alt', replaceValue(node.getAttribute('alt')));
        break;  // 子要素なし
      else if(['OPTGROUP', 'OPTION'].includes(node.tagName) && !isEmpty(node.getAttribute('label'))) {
        console.log('Opt', node.tagName);
        node.setAttribute('label', replaceValue(node.getAttribute('label')));
        // break しないことで optgroup 配下の option、および option 配下の TextNode も変換する
			let child = node.firstChild; // childNodes を for ループする場合よりも要素の増減でバグりにくいと思う
      console.log(debugDepthIndent, node.nodeType, node.tagName, 'Start', child);
			while(child) {
        if(!['SCRIPT', 'STYLE', 'IFRAME', 'NOSCRIPT', 'FRAME'].includes(child.tagName)) {  // 必ず除外したいモノ
          //console.log(debugDepthIndent, 'Call Child', child.nodeType, child.tagName);
  				walk(child, debugDepth + 1);
				child = child.nextSibling;
      console.log(debugDepthIndent, node.nodeType, node.tagName, 'End');
		case 3:  // Text node
      if(node.nodeValue.trim() !== '') {
        console.log(debugDepthIndent, 'Text Node', `[${node.nodeValue}]`);
        node.nodeValue = replaceValue(node.nodeValue);
      console.log(debugDepthIndent, node.nodeType, node.tagName, 'Unknown Node Type');

// 仮で変換処理
function replaceValue(originalValue) {
  return originalValue.replace((/[a-z]/gu), match => match.toUpperCase());

function isEmpty(value) {
  return value === undefined || value === null || value === '';

document.addEventListener('DOMContentLoaded', () => {
  document.getElementById('test').addEventListener('click', () => {