alexmilowski / green-turtle

An RDFa 1.1. implementation for browsers.
MIT License
56 stars 20 forks source link

Wrong element data object for typed child #4

Open alexmilowski opened 9 years ago

alexmilowski commented 9 years ago

In the follow example, the schema:Organization typed child doesn't not have the right .data value on the element. It has the schema:Person instance instead of its own.

<div typeof="Person">
      <p property="name">Alex Milowski</p>
      <div property="affiliation" resource="http://ischool.berkeley.edu/" typeof="Organization">
          <p><span property="department">School of Information</span>, <span property="name">University of California, Berkeley</span></p>
      </div>
 </div>
sballesteros commented 8 years ago

This has been resolved right?

Running

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8"/>
  </head>
  <body>
    <div vocab="http://schema.org/">
      <div typeof="Person">
        <p property="name">Alex Milowski</p>
        <div property="affiliation" resource="http://ischool.berkeley.edu/" typeof="Organization">
          <p><span property="department">School of Information</span>, <span property="name">University of California, Berkeley</span></p>
        </div>
      </div>
    </div>
    <script src="green-turtle/build/RDFa.js"></script>
  </body>
</html>

Produces (document.data.graph.toString() in the console) the right data:

_:1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person>;
 <http://schema.org/name> "Alex Milowski";
 <http://schema.org/affiliation> <http://ischool.berkeley.edu/> .

 <http://ischool.berkeley.edu/> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Organization>;
 <http://schema.org/department> "School of Information";
 <http://schema.org/name> "University of California, Berkeley" .