code: private void addCommonAttrMappings(JSONObject root, JSONObject node) throws JSONException {
      for (String property : GRANITE_COMMON_ATTR_PROPERTIES) {
        String[] mapping = { "${./" + property + "}", "${\'./granite:" + property + "\'}" };
        mapProperty(root, node, "granite:" + property, mapping);
      }
  
      if (root.has(NN_GRANITE_DATA)) {
        // the root has granite:data defined, copy it before applying data-* properties
        node.put(NN_GRANITE_DATA, root.get(NN_GRANITE_DATA));
      }
  
      // map data-* prefixed properties to granite:data child
      for (Map.Entry<String, Object> entry : getProperties(root).entrySet()) {
        if (!StringUtils.startsWith(entry.getKey(), DATA_PREFIX)) {
          continue;
        }
  
        // add the granite:data child if necessary
        JSONObject dataNode;
        if (!node.has(NN_GRANITE_DATA)) {
          dataNode = new JSONObject();
          node.put(NN_GRANITE_DATA, dataNode);
        }
        else {
          dataNode = node.getJSONObject(NN_GRANITE_DATA);
        }
  
        // set up the property mapping
        String nameWithoutPrefix = entry.getKey().substring(DATA_PREFIX.length());
        mapProperty(root, dataNode, nameWithoutPrefix, "${./" + entry.getKey() + "}");
      }
    }
docs: Adds property mappings on a replacement node for Granite common attributes.
  @param root the root node
  @param node the replacement node
  @throws JSONException