Skip to content

[MdOption] Cannot read property 'trim' of undefined #1863

@MNSolderstar

Description

@MNSolderstar

Steps to reproduce

Any HTML in an md-option triggers a Vue Warn reporting an error.

 <md-field>
	<label for="profile">Process Profile</label>
	<md-select v-model="selected.profile" name="" :placeholder="placeholder.profile" id="profile">
		<md-option v-for="(packet,index) in list.profiles" :key="packet.id" :value="index">
			<span>Hello</span> World
		</md-option>
	</md-select>
</md-field>

Which browser?

Google Chrome 67.0.3396.99 (Official Build) (64-bit)
VUE : 2.5.16
VUE Material : 1.0.0-beta-10.2

What is actually happening?

[Vue warn]: Error in created hook: "TypeError: Cannot read property 'trim' of undefined"
TypeError: Cannot read property 'trim' of undefined

Triggered by source:

getTextContent: function getTextContent() {
     if (this.$el) {
       return this.$el.textContent.trim();
     }

     var slot = this.$slots.default;

     return slot ? slot[0].text.trim() : ''; // <--- call to trim() on undefined in this line
},

Reproduction Link

https://codesandbox.io/s/9o9jw9wy4y

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions