diff options
author | Gareth Aye <gaye@mozilla.com> | 2014-04-09 15:38:41 -0400 |
---|---|---|
committer | Gareth Aye <gaye@mozilla.com> | 2014-04-09 15:38:41 -0400 |
commit | a1cfcdfcc5acfe9c233267073fe67d24cdee000c (patch) | |
tree | 77d5299e63ae923a20457eae50ac1353990d5752 /lib/caldav | |
parent | c197deab25d8425bdfa8d8d2feccedbb2776a48e (diff) | |
parent | b15fe723595219e0e31ec84af246446668d297c8 (diff) | |
download | jsCalDAV-a1cfcdfcc5acfe9c233267073fe67d24cdee000c.tar.gz |
Merge pull request #21 from gaye/bug-974554
Bug 974554 - CalDAV parser should accept ical inside xml comments nested in <calendar-data> elements r=millermedeiros
Diffstat (limited to 'lib/caldav')
-rw-r--r-- | lib/caldav/sax.js | 5 | ||||
-rw-r--r-- | lib/caldav/sax/calendar_data_handler.js | 17 |
2 files changed, 18 insertions, 4 deletions
diff --git a/lib/caldav/sax.js b/lib/caldav/sax.js index e0c0a1b..c861eee 100644 --- a/lib/caldav/sax.js +++ b/lib/caldav/sax.js @@ -18,6 +18,7 @@ var events = [ 'ontext', + 'oncdata', 'onopentag', 'onclosetag', 'onerror', @@ -198,6 +199,10 @@ this._fireHandler('ontext', data); }, + oncdata: function(data) { + this._fireHandler('oncdata', data); + }, + onerror: function(data) { //TODO: XXX implement handling of parsing errors. //unlikely but possible if server goes down diff --git a/lib/caldav/sax/calendar_data_handler.js b/lib/caldav/sax/calendar_data_handler.js index d24bfb0..ac55c78 100644 --- a/lib/caldav/sax/calendar_data_handler.js +++ b/lib/caldav/sax/calendar_data_handler.js @@ -14,12 +14,21 @@ //value where key is local tag name //and value is the text. ontext: function(data) { - var handler = this.handler; - this.current[this.currentTag[handler.tagField]] = - CalendarDataHandler.parseICAL(data); - } + return CalendarDataHandler.ondata.call(this, data); + }, + + // Servers can also stash ical data inside of an xml cdata. + oncdata: function(data) { + return CalendarDataHandler.ondata.call(this, data); + }, }); + CalendarDataHandler.ondata = function(data) { + var handler = this.handler; + this.current[this.currentTag[handler.tagField]] = + CalendarDataHandler.parseICAL(data); + }; + /** * Default ical parser handler. * |