Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for change events on <select> elements #8943

Merged
merged 4 commits into from Apr 26, 2017

Conversation

kmh287
Copy link
Contributor

@kmh287 kmh287 commented Apr 25, 2017

Mostly just expands on the work done to support input elements.

Fixes #8939

Copy link

@dreamofabear dreamofabear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick turnaround.

@@ -216,6 +216,9 @@ export class ActionService {
});
event.detail = detail;
}
} else if (event.target.tagName.toLowerCase() === 'select') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommend moving LHS to a local tagName var and use a switch statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea

detail[field] = String(value);
}
});
const tagName = event.target.tagName.toLowerCase();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: target instead of event.target.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}
break;
case 'select':
detail['value'] = target['value'];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

detail.value = target.value;?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -199,23 +199,30 @@ export class ActionService {
addChangeDetails_(event) {
const detail = {};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const detail = map();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

detail[field] = String(value);
}
});
event.detail = detail;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably can take this out of the switch to reduce dupe.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, but we should only set this if detail isn't empty

@kmh287 kmh287 merged commit e1b858e into ampproject:master Apr 26, 2017
mrjoro pushed a commit to mrjoro/amphtml that referenced this pull request Apr 28, 2017
KenneyE pushed a commit to spotxchange/amphtml that referenced this pull request May 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants