Skip to content
This repository was archived by the owner on Apr 4, 2019. It is now read-only.

Fix <input disabled> #239

Merged
merged 1 commit into from
Jan 8, 2015
Merged

Conversation

linstula
Copy link
Contributor

@linstula linstula commented Jan 6, 2015

Demo showing the same is parsed as disabled: true in normal HTML: http://jsbin.com/magegorene/1/

paired with @rwjblue on this.

@mixonic
Copy link
Collaborator

mixonic commented Jan 6, 2015

@rwjblue is going to take a quick look here, I'll followup regardless this week.

@linstula linstula force-pushed the failing-test-for-disabled branch from 9f2d646 to b6abf51 Compare January 6, 2015 20:02
@linstula
Copy link
Contributor Author

linstula commented Jan 6, 2015

As discussed between @rwjblue and @mixonic we need to change packages/htmlbars-compiler/lib/fragment-javascript-compiler.js#L64 to call setAttribute instead of setProperty to fix this issue. Looks like the changes from #235 made this somewhat more complicated.

@rwjblue
Copy link
Collaborator

rwjblue commented Jan 8, 2015

emberjs/ember.js#10169 is due to the same underlying issue.

@oneeman
Copy link
Contributor

oneeman commented Jan 8, 2015

I'd be happy to give this a shot, but I'm not really clear on when setAttribute should be used vs when setProperty should. So, just to make sure, Is it a matter of using setAttribute or setAttributeNS everywhere in the build() method? Or are there also issues when it comes to hydration/morphs?

@oneeman
Copy link
Contributor

oneeman commented Jan 8, 2015

ok, this works, go ahead and add it please:

FragmentJavaScriptCompiler.prototype.setAttribute = function(name, value, namespace) {
  var el = 'el'+this.depth;
  if (namespace) {
    this.source.push(this.indent+'  dom.setAttributeNS('+el+','+string(namespace)+','+string(name)+','+string(value)+
                     ');\n');
  } else {
    this.source.push(this.indent+'  dom.setAttribute('+el+','+string(name)+','+string(value)+');\n');
  }
};

There's a bit of duplication between the then and else clauses, but trying to eliminate would probably only make it more complicated.

@linstula linstula force-pushed the failing-test-for-disabled branch from b6abf51 to 1192464 Compare January 8, 2015 17:39
@linstula
Copy link
Contributor Author

linstula commented Jan 8, 2015

@oneeman thanks for putting in the work for this. Should be good to go.

@linstula linstula changed the title Failing test for <input disabled> not setting disabled prop. Fix <input disabled> Jan 8, 2015
@oneeman
Copy link
Contributor

oneeman commented Jan 8, 2015

Thank you! The test failures are from before on IE, so I'll go ahead and merge.

oneeman added a commit that referenced this pull request Jan 8, 2015
@oneeman oneeman merged commit 9f439bd into tildeio:master Jan 8, 2015
@zeppelin
Copy link

zeppelin commented Jan 8, 2015

👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants