It comes down to terminology, since “integrates” is typically understood in the sense of Lebesgue when formulating finite element methods, so integrating over element interiors is equivalent to integrating over the full domain, and it’s simply invalid to talk about integrating an object like -\nabla\cdot(\nabla\phi^h), since it’s not a function. (It’s arguably an abuse of notation to write things like \int \delta_0(x)v(x)\,dx = v(0); really it’s the application of a linear functional \delta_0 to the function v, i.e., \langle \delta_0, v\rangle.) From that perspective, it’s a user error to ask for an ill-defined integral. However, that’s not the full story, since many residual-based stabilized methods actually do include terms that are only integrable on element interiors and should technically be written using a sum over element integrals, which is one reason I can think of why things like inner(-div(grad(phi)),v)*dx
are allowed to compile without errors.
EDIT: To answer the question more directly, yes, the UFL manual explicitly defines the dx
measure as a sum over element integrals. See the formula at the bottom of page 4.