This has been hard to figure out as a black box. So I looked at the source code for App Lab.
Each element type has a list of properties that can be set by
setProperty. That list of properties is populated into the dropdown list of choices after you choose an id. Prior to that choice, the dropdown list has more properties than are valid for any one element type.
The properties that are allowed are not necessarily the property or style that gets changed. For example
"icon-color" affects the
data-icon-color. Other properties are set directly as named. Those properties are in a white list of properties that will not break the sandbox and checked at runtime. All properties sent are checked against the same dropdown list that you choose them from for validity, again at run time. They are not checked prior to running the code.
So if you drag and drop
setProperty into your program and choose a property before choosing an element you can select a property that will not work. One such property is
"icon-size". As far as I can tell that property is not valid for any element type and probably should be removed. When you run the program it throws an error.
I said earlier that I look at properties available in HTML and CSS to try to guess what property might work. That is a really bad idea. Not all properties use the same name, nor are they in the white list of allowed properties. Instead, you want to fill each parameter from the dropdown in left to right order; dropdown the id and choose, then drop down the property and choose again. Doing that guarantees you will not get a runtime error.
When in text mode the dropdown list will appear as you type. Use the list. The documentation seems incomplete.
So for this lesson, it seems like a bug because we are not using a defined element id as we create our code. We expect all the properties to work. But because we are computing the element id as
"image" + i the dropdown list of properties includes some that will not work with an image. I recommend choosing one of the images like
"image0" then choose the property. Then change the id to the computed value. That way you know you chose well.