view nothing.js @ 14:03be0717d3f8

Use the same code for client- and server-side Atom parsing.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 03 Nov 2011 16:42:00 -0700
parents 161d4ea1c3f8
children
line wrap: on
line source

'use strict';

parsers[''] = function(item) {
	var toDate = function() {
		return new Date();
	};

	var toHTML = function(item, date) {
		var article = document.createElementNS(ns.xhtml, 'article');
		article.setAttributeNS(ns.e, 'id', item.id);
		article.setAttributeNS(ns.e, 'date', date.to8601());
		article.appendChild(document.createElementNS(ns.xhtml, 'h2').appendChild(document.createTextNode('This post is in an unknown namespace.')));
		return article;
	};

	this.xml = item.payload;
	this.date = toDate();
	this.html = toHTML(item, this.date);
}