index.js
function createProperties(el) {
	var properties = {};

	if (!el.hasAttributes()) {
		return properties;
	}

	var ns;
	if (el.namespaceURI && el.namespaceURI !== HTML_NAMESPACE) {
		ns = el.namespaceURI;
	}

	var attr;
	for (var i = 0; i < el.attributes.length; i++) {
		// use built in css style parsing
		if(el.attributes[i].name == 'style'){
			attr = createStyleProperty(el);
		}
		else if (ns) {
			attr = createPropertyNS(el.attributes[i]);
		} else {
			attr = createProperty(el.attributes[i]);
		}

		// special case, namespaced attribute, use properties.foobar
		if (attr.ns) {
			properties[attr.name] = {
				namespace: attr.ns
				, value: attr.value
			};

		// special case, use properties.attributes.foobar
		} else if (attr.isAttr) {
			// init attributes object only when necessary
			if (!properties.attributes) {
				properties.attributes = {}
			}
			properties.attributes[attr.name] = attr.value;

		// default case, use properties.foobar
		} else {
			properties[attr.name] = attr.value;
		}
	};

	return properties;
}
function createProperties(el) {
	var properties = {};

	if (!el.hasAttributes()) {
		return properties;
	}

	var ns;
	if (el.namespaceURI && el.namespaceURI !== HTML_NAMESPACE) {
		ns = el.namespaceURI;
	}

	var attr;
	for (var i = 0; i < el.attributes.length; i++) {
		// use built in css style parsing
		if(el.attributes[i].name == 'style'){
			attr = createStyleProperty(el);
		}
		else if (ns) {
			attr = createPropertyNS(el.attributes[i]);
		} else {
			attr = createProperty(el.attributes[i]);
		}

		// special case, namespaced attribute, use properties.foobar
		if (attr.ns) {
			properties[attr.name] = {
				namespace: attr.ns
				, value: attr.value
			};

		// special case, use properties.attributes.foobar
		} else if (attr.isAttr) {
			// init attributes object only when necessary
			if (!properties.attributes) {
				properties.attributes = {}
			}
			properties.attributes[attr.name] = attr.value;

		// default case, use properties.foobar
		} else {
			properties[attr.name] = attr.value;
		}
	};

	return properties;
}
function createProperties ( el ) { var properties = { } ; if ( ! el . hasAttributes ( ) ) { return properties ; } var ns ; if ( el . namespaceURI && el . namespaceURI !== HTML_NAMESPACE ) { ns = el . namespaceURI ; } var attr ; for ( var i = 0 ; i < el . attributes . length ; i ++ ) { // use built in css style parsing if ( el . attributes [ i ] . name == 'style' ) { attr = createStyleProperty ( el ) ; } else if ( ns ) { attr = createPropertyNS ( el . attributes [ i ] ) ; } else { attr = createProperty ( el . attributes [ i ] ) ; } // special case, namespaced attribute, use properties.foobar if ( attr . ns ) { properties [ attr . name ] = { namespace : attr . ns , value : attr . value } ; // special case, use properties.attributes.foobar } else if ( attr . isAttr ) { // init attributes object only when necessary if ( ! properties . attributes ) { properties . attributes = { } } properties . attributes [ attr . name ] = attr . value ; // default case, use properties.foobar } else { properties [ attr . name ] = attr . value ; } } ; return properties ; }
Create properties from dom node

@param   Object  el  DOM element
@return  Object      Node properties and attributes
Create properties from dom node