From f91d1e669797abd6530236f631f161ced985fbcb Mon Sep 17 00:00:00 2001 From: "mkaply%us.ibm.com" Date: Wed, 19 Mar 2008 19:20:41 +0000 Subject: [PATCH] bug 420144 - r=sayrer, a=schrep - only bubble up mf properties if the parent microformat wouldn't want it anyway git-svn-id: svn://10.0.0.236/trunk@248176 18797224-902f-48f8-a5cc-f745e15eee43 --- .../components/microformats/src/Microformats.js | 15 +++++++++++++-- .../microformats/tests/test_Microformats.html | 12 ++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/mozilla/toolkit/components/microformats/src/Microformats.js b/mozilla/toolkit/components/microformats/src/Microformats.js index 7d881dfba65..afd041cb165 100644 --- a/mozilla/toolkit/components/microformats/src/Microformats.js +++ b/mozilla/toolkit/components/microformats/src/Microformats.js @@ -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) { diff --git a/mozilla/toolkit/components/microformats/tests/test_Microformats.html b/mozilla/toolkit/components/microformats/tests/test_Microformats.html index 7bf6f829b21..3d405ba9f73 100644 --- a/mozilla/toolkit/components/microformats/tests/test_Microformats.html +++ b/mozilla/toolkit/components/microformats/tests/test_Microformats.html @@ -85,6 +85,15 @@ 1998-01-22 +
+
+ + Mozilla's Birthday + +
+ 1998-01-22 +
+