bug 420144 - r=sayrer, a=schrep - only bubble up mf properties if the parent microformat wouldn't want it anyway

This commit is contained in:
mkaply@us.ibm.com 2008-03-19 12:20:41 -07:00
parent 879564502a
commit 9314e4b51c
2 changed files with 25 additions and 2 deletions

View File

@ -722,9 +722,20 @@ var Microformats = {
xpathResult.singleNodeValue.microformat = mfname;
parentnode = xpathResult.singleNodeValue;
}
/* If the propnode is not a child of the microformat, remove it*/
/* If the propnode is not a child of the microformat, and */
/* the property belongs to the parent microformat as well, */
/* remove it. */
if (parentnode != mfnode) {
propnodes.splice(i,1);
var mfNameString = Microformats.getNamesFromNode(parentnode);
var mfNames = mfNameString.split(" ");
var j;
for (j=0; j < mfNames.length; j++) {
/* If this property is in the parent microformat, remove the node */
if (Microformats[mfNames[j]].properties[propname]) {
propnodes.splice(i,1);;
break;
}
}
}
}
if (propnodes.length > 0) {

View File

@ -85,6 +85,15 @@
<span class="dtstart">1998-01-22</span>
</div>
<div class="vevent" id="vcal_vcard">
<div class="vcard">
<span class="description">
<span class="fn org">Mozilla</span>'s Birthday
</span>
</div>
<span class="dtstart">1998-01-22</span>
</div>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
@ -152,6 +161,9 @@ function test_Microformats() {
jsdate = Microformats.dateFromISO8601(dateCal.dtstart);
origdate = Microformats.iso8601FromDate(jsdate, true);
is(dateCal.dtstart, origdate, "date round trip");
var dateCal = new hCalendar(document.getElementById("vcal_vcard"));
is(dateCal.description, "Mozilla's Birthday", "vcard in vcal");
}
function test_hCard() {