SteveSanderson / knockout.mapping

Object mapping plugin for KnockoutJS
Other
546 stars 767 forks source link

mapping fails if value = "constructor" #196

Open ale33 opened 10 years ago

ale33 commented 10 years ago
data = 
{
   "cId":9595,
   "histories":[
      {
         "cId":9595,
         "jobTitle":"lifeguard",
         "jobDesc":"watch people and the pool, cleaning the pool"
      },
      {
         "cId":9595,
         "jobTitle":"constructor",
         "jobDesc":"I lay down pavement marking on road. this means thermoplastic, tape, and paint."
      }
   ]
}

function FormData (data) {
    var self = this;
    ko.mapping.fromJS(data, {}, self);
}

It fails because the "jobTitle":"constructor". It works if "jobTitle":"SOMETHING ELSE"

nyothecat commented 10 years ago

Nice one! Have you tried "prototype", "proto", stuff like that? I guess it should fail too

ghost commented 9 years ago

I fixed it in commit d897dedb990a6666ec9d9d66db3973d2098d9cd8